/* ==========================================================================
   Codfy — Hero de la TIENDA de addons (solo /shop).
   Se inyecta arriba del listado nativo de website_sale. HTML/CSS/JS propios.
   Reutiliza las variables --cf-* definidas en style.css (cargado en el layout).
   ========================================================================== */

.cf-custom {
    position: relative;
    padding: clamp(48px, 7vw, 100px) clamp(20px, 5vw, 64px);
    background:
        radial-gradient(1100px 560px at 82% -12%, rgba(79, 156, 249, 0.16), transparent 60%),
        var(--cf-bg);
    border-top: 1px solid var(--cf-border);
    overflow: hidden;
}
.cf-custom__inner {
    /* Mismo ancho que el hero de la portada (`--cf-nav-max`, 1800px) y no el
       del contenido corriente (`--cf-max`, 1120px): este bloque es una pieza
       de escaparate y necesita el ancho para que el editor se lea. */
    max-width: var(--cf-nav-max);
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    gap: clamp(28px, 4vw, 56px);
    align-items: center;
}

/* ----- Texto (desarrollo a la medida) ----- */
.cf-custom__title {
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    line-height: 1.08;
    letter-spacing: -0.02em;
    margin: 0.35em 0 0.4em;
}
.cf-custom__title .cf-grad {
    background: linear-gradient(120deg, var(--cf-primary), #8bd0ff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.cf-custom__sub {
    color: var(--cf-muted);
    font-size: clamp(1rem, 1.5vw, 1.15rem);
    line-height: 1.6;
    margin: 0;
}
.cf-custom__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: clamp(18px, 2.5vw, 28px);
}
/* El botón es el mismo `cf-hero__cta` de la portada (style.css). Aquí solo se
   le quita el `margin-top` del hero: en esta sección el aire ya lo pone
   `.cf-custom__actions`, y sumado quedaba despegado del párrafo. */
.cf-custom__actions .cf-hero__cta { margin-top: 0; }

@media (max-width: 900px) {
    .cf-custom__inner { grid-template-columns: 1fr; }
}

/* ==========================================================================
   EDITOR SIMULADO (Visual Studio Code) + su terminal.

   La paleta es la de VS Code Dark+ a propósito: es un guiño que el visitante
   técnico reconoce al instante. Los tokens de color (`tk-*`) los pone
   shop_hero.js al teclear.
   ========================================================================== */

.cf-vs {
    --vs-bg:      #1e1e1e;   /* fondo del editor */
    --vs-chrome:  #323233;   /* barra de título */
    --vs-tabs:    #252526;   /* tira de pestañas */
    --vs-panel:   #181818;   /* panel inferior (terminal) */
    --vs-line:    #2b2b2b;   /* separadores */
    --vs-text:    #d4d4d4;
    --vs-dim:     #858585;

    display: flex;
    flex-direction: column;
    /* Alto FIJO, no `height:100%` ni `min-height`: con una altura elástica la
       ventana crecía renglón a renglón mientras se teclea el programa y toda la
       sección daba tirones. El editor y la terminal tienen su propio
       desplazamiento, así que el contenido cabe igual. */
    height: 600px;
    background: var(--vs-bg);
    border: 1px solid var(--vs-line);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

/* ----- Barra de título ----- */
.cf-vs__bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    padding: 10px 14px;
    background: var(--vs-chrome);
    border-bottom: 1px solid var(--vs-line);
}
.cf-vs__dot { width: 12px; height: 12px; border-radius: 50%; }
.cf-vs__dot--r { background: #ff5f56; }
.cf-vs__dot--y { background: #ffbd2e; }
.cf-vs__dot--g { background: #27c93f; }
.cf-vs__title {
    margin-left: auto;
    margin-right: auto;
    padding-right: 44px;   /* compensa los tres puntos y deja el título centrado */
    color: var(--vs-dim);
    font-size: 12px;
}

/* Barras de desplazamiento DENTRO de la ventana: aquí el fondo es oscuro, así
   que la barra clara del sitio (style.css) cantaba. Se imita la de VS Code:
   pulgar gris translúcido, sin redondear y sin pista, de modo que parece
   flotar sobre el código. */
.cf-vs *,
.cf-vs { scrollbar-color: rgba(121, 121, 121, .5) transparent; }
.cf-vs ::-webkit-scrollbar { width: 10px; height: 10px; }
.cf-vs ::-webkit-scrollbar-track { background: transparent; }
.cf-vs ::-webkit-scrollbar-thumb {
    background-color: rgba(121, 121, 121, .4);
    border-radius: 0;
    border: 0;
}
.cf-vs ::-webkit-scrollbar-thumb:hover { background-color: rgba(121, 121, 121, .7); }
.cf-vs ::-webkit-scrollbar-thumb:active { background-color: rgba(159, 159, 159, .9); }

/* ----- Cuerpo: explorador + zona de trabajo ----- */
.cf-vs__body {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;          /* sin esto los hijos con scroll no se encogen */
}
.cf-vs__main {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
}

/* ----- Explorador de archivos ----- */
.cf-vs__side {
    flex: 0 0 168px;
    overflow: auto;
    padding: 10px 0 12px;
    background: var(--vs-tabs);
    border-right: 1px solid var(--vs-line);
    font-size: 11.5px;
    line-height: 1.9;
    user-select: none;
}
.cf-vs__sidetitle {
    padding: 0 12px 8px;
    color: var(--vs-dim);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
}
.cf-vs__node {
    display: flex;
    align-items: center;
    gap: 6px;
    /* La sangría del árbol sale del `--nivel` que lleva cada fila en línea. */
    padding: 1px 10px 1px calc(10px + var(--nivel, 0) * 12px);
    color: #c5c5c5;
    white-space: nowrap;
}
.cf-vs__node--root { color: #fff; font-weight: 700; letter-spacing: .03em; }
.cf-vs__node--dir { color: #d7d7d7; }
.cf-vs__node--on {
    background: rgba(0, 83, 255, .22);
    color: #fff;
    box-shadow: inset 2px 0 0 0 #0053ff;
}
.cf-vs__chev { color: var(--vs-dim); width: .7em; display: inline-block; }
.cf-vs__node--cerrado .cf-vs__chev { transform: translateY(-1px); }
.cf-vs__fico {
    font-size: 8px;
    font-weight: 700;
    letter-spacing: .03em;
    color: #4b8bbe;          /* PY, azul de Python */
}
.cf-vs__fico--x { color: #e37933; }   /* XML */
.cf-vs__fico--m { color: #6a9955; }   /* Markdown */

/* ----- Pestañas de archivo ----- */
.cf-vs__tabs {
    display: flex;
    flex: 0 0 auto;
    background: var(--vs-tabs);
    border-bottom: 1px solid var(--vs-line);
}
.cf-vs__tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    color: var(--vs-dim);
    font-size: 12.5px;
    border-right: 1px solid var(--vs-line);
}
.cf-vs__tab--on {
    background: var(--vs-bg);
    color: #fff;
    /* La franja azul de arriba es la marca de "pestaña activa" de VS Code. */
    box-shadow: inset 0 2px 0 0 #0053ff;
}
.cf-vs__tabico {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .04em;
    color: #4b8bbe;      /* azul del logotipo de Python */
}
.cf-vs__tabx { color: var(--vs-dim); font-size: 14px; line-height: 1; }

/* ----- Editor ----- */
.cf-vs__editor {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding: 12px 0;
    font-size: clamp(11.5px, 1.15vw, 13.5px);
    line-height: 1.7;
    tab-size: 4;
}
.cf-vs__line { display: flex; }
.cf-vs__ln {
    flex: 0 0 auto;
    width: 3.2em;
    padding-right: 1em;
    text-align: right;
    color: #4a4a4a;
    user-select: none;
}
.cf-vs__code {
    flex: 1 1 auto;
    padding-right: 14px;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--vs-text);
}
.cf-vs__caret {
    display: inline-block;
    width: 2px;
    height: 1.05em;
    margin-left: 1px;
    vertical-align: -2px;
    background: #aeafad;
    animation: cf-vs-blink 1s steps(1) infinite;
}
@keyframes cf-vs-blink { 50% { opacity: 0; } }

/* Resaltado de sintaxis (VS Code Dark+). */
.tk-kw    { color: #569cd6; }
.tk-cls   { color: #4ec9b0; }
.tk-fn    { color: #dcdcaa; }
.tk-dec   { color: #dcdcaa; }
.tk-str   { color: #ce9178; }
.tk-num   { color: #b5cea8; }
.tk-param { color: #9cdcfe; }
.tk-var   { color: #9cdcfe; }
.tk-com   { color: #6a9955; font-style: italic; }

/* ----- Panel inferior con la terminal ----- */
.cf-vs__panel {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    height: 190px;
    background: var(--vs-panel);
    border-top: 1px solid var(--vs-line);
}
.cf-vs__paneltabs {
    display: flex;
    gap: 18px;
    flex: 0 0 auto;
    padding: 8px 14px 0;
    border-bottom: 1px solid var(--vs-line);
}
.cf-vs__paneltab {
    padding-bottom: 6px;
    color: var(--vs-dim);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .09em;
}
.cf-vs__paneltab--on {
    color: #fff;
    box-shadow: inset 0 -1px 0 0 #fff;
}
.cf-vs__term {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding: 10px 14px 12px;
    font-size: clamp(11.5px, 1.1vw, 13px);
    line-height: 1.65;
    color: var(--vs-text);
}
.cf-vs__outline { white-space: pre-wrap; min-height: 1.65em; }
.cf-vs__cmd  { color: #fff; }
.cf-vs__ask  { color: #dcdcaa; }
.cf-vs__echo { color: #9cdcfe; }
.cf-vs__ok   { color: #4ec9b0; }
.cf-vs__err  { color: #f48771; }

/* Prompt: es un campo de verdad, aquí se responde el acertijo. */
.cf-vs__prompt {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
}
.cf-vs__promptsign { color: #4ec9b0; flex: 0 0 auto; }
.cf-vs__input {
    flex: 1 1 auto;
    min-width: 0;
    border: 0;
    background: transparent;
    color: #fff;
    font: inherit;
    padding: 2px 0;
    outline: none;
    caret-color: #4ec9b0;
}
.cf-vs__input:disabled { opacity: .6; }

/* El explorador es lo primero que sobra cuando falta ancho: en tableta y móvil
   se quita y el editor se queda con todo el espacio. */
@media (max-width: 900px) {
    .cf-vs__side { display: none; }
}

@media (max-width: 640px) {
    .cf-vs { height: 460px; }
    .cf-vs__panel { height: 165px; }
    .cf-vs__ln { width: 2.4em; padding-right: .6em; }
    .cf-vs__title { display: none; }
}

/* ==========================================================================
   MODAL DEL PREMIO (formulario con descuento)
   ========================================================================== */

body.cf-modal-abierto { overflow: hidden; }

.cf-modal {
    position: fixed;
    inset: 0;
    z-index: 2147482000;   /* por debajo del loader del sitio, encima del resto */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.cf-modal[hidden] { display: none; }

.cf-modal__fondo {
    position: absolute;
    inset: 0;
    background: rgba(14, 13, 50, 0.55);
    backdrop-filter: blur(2px);
}
.cf-modal__caja {
    position: relative;
    width: min(520px, 100%);
    max-height: calc(100vh - 40px);
    overflow: auto;
    padding: 30px clamp(20px, 4vw, 34px) 30px;
    background: var(--cf-bg);
    border-radius: 18px;
    box-shadow: 0 40px 90px rgba(14, 13, 50, 0.35);
    font-family: var(--cf-font);
}
.cf-modal__x {
    position: absolute;
    top: 12px;
    right: 14px;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--cf-muted);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}
.cf-modal__x:hover { background: var(--cf-surface); color: var(--cf-text); }

.cf-modal__badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 999px;
    background: #16a34a;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .02em;
}
.cf-modal__title {
    margin: 12px 0 6px;
    font-size: clamp(1.5rem, 3vw, 1.9rem);
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--cf-text);
}
.cf-modal__lead {
    margin: 0 0 20px;
    color: var(--cf-muted);
    font-size: .95rem;
    line-height: 1.55;
}

.cf-modal__ok h3 { font-size: 1.3rem; font-weight: 600; margin: 10px 0 6px; }
.cf-modal__ok p  { color: var(--cf-muted); margin: 0; }
.cf-modal__ok[hidden] { display: none; }

.cf-modal__aviso {
    margin-bottom: 14px;
    padding: 10px 13px;
    border: 1px solid rgba(217, 45, 32, .35);
    border-radius: 10px;
    background: rgba(217, 45, 32, .06);
    color: #b42318;
    font-size: .85rem;
}
.cf-modal__aviso[hidden] { display: none; }

/* Trampa antispam: fuera de la vista pero NO con display:none, que algunos
   bots detectan. Igual que en el formulario de /contacto. */
.cf-modal__trap {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.cf-modal__fld { display: block; margin-bottom: 14px; }
.cf-modal__fld > span {
    display: block;
    margin-bottom: 6px;
    font-size: .8rem;
    font-weight: 600;
    color: var(--cf-text);
}
.cf-modal__fld input,
.cf-modal__fld textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--cf-border);
    border-radius: 10px;
    background: var(--cf-bg);
    color: var(--cf-text);
    font-family: var(--cf-font);
    font-size: .95rem;
    resize: vertical;
}
.cf-modal__fld input:focus,
.cf-modal__fld textarea:focus {
    outline: none;
    border-color: var(--cf-primary);
    box-shadow: 0 0 0 3px rgba(0, 83, 255, .12);
}

.cf-modal__enviar {
    width: 100%;
    margin-top: 6px;
    padding: 14px 20px;
    border: 0;
    border-radius: 12px;
    background: var(--cf-primary);
    color: var(--cf-on-primary);
    font-family: var(--cf-font);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s ease, transform .15s ease;
}
.cf-modal__enviar:hover:not(:disabled) {
    background: var(--cf-primary-2);
    transform: translateY(-1px);
}
.cf-modal__enviar:disabled { opacity: .65; cursor: default; }
