@font-face {
    font-family: FSEX302;
    src: url(https://bringfeel.com.ar/assets/css/FSEX302.ttf);
}

/* ========================= */
/* VARIABLES & RESET         */
/* ========================= */

:root {
    --bg: #141414;
    --card-bg: rgba(183, 204, 88, 0.35);
    --card-hover-bg: rgb(90, 100, 43);
    --converter-bg: #11213a;
    --accent-green: #68d391;
    --accent-bright: #28ca00;
    --price-color: #54e98d;
    --dolar-color: #b3ad60;
    --text-light: #e8e6e3;
    --shadow: 8px 4px 16px rgba(0, 0, 0, 0.7);
    --radius: 15px;
    --header-height: 64px;
}

*, *::before, *::after {
    box-sizing: border-box;
}

body, html {
    width: 100%;
    margin: 0;
    padding: 0;
    font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
}

body {
    background-color: var(--bg);
    display: block;
}

/* ========================= */
/* HEADER                    */
/* ========================= */

header {
    font-family: FSEX302;
    text-align: center;
    background: linear-gradient(
        180deg,
        rgba(17, 33, 58, 0.95) 80%,
        rgba(17, 33, 58, 0.6) 93%,
        rgba(17, 33, 58, 0) 100%
    );
    position: fixed;
    width: 100%;
    top: 0;
    padding: 12px 16px;
    z-index: 999;
}

#marketText {
    color: var(--accent-green);
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
    font-size: clamp(1.5rem, 4vw, 2.8rem);
    margin: 0;
    letter-spacing: 0.05em;
}

/* ========================= */
/* CONVERTER SECTION         */
/* ========================= */

#converterSection {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-top: calc(var(--header-height) + 48px);
    margin-bottom: 24px;
    padding: 0 16px;
}

.converterCard {
    background: var(--converter-bg);
    padding: clamp(16px, 4vw, 28px);
    border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    text-align: center;
    width: 100%;
    max-width: 440px;
}

.converterCard h2 {
    color: var(--accent-green);
    margin-top: 0;
    margin-bottom: 16px;
    font-size: clamp(1rem, 3vw, 1.4rem);
}

.converterForm {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.converterForm input,
.converterForm select {
    padding: 10px 12px;
    border-radius: 8px;
    border: none;
    outline: none;
    font-size: clamp(0.85rem, 2.5vw, 1rem);
    flex: 1 1 120px;
    min-width: 0;
}

.converterForm button {
    padding: 10px 18px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    background-color: var(--accent-bright);
    color: black;
    font-weight: bold;
    font-size: clamp(0.85rem, 2.5vw, 1rem);
    transition: background-color 0.3s;
    flex: 0 0 auto;
}

.converterForm button:hover {
    background-color: #1fa000;
}

/* ========================= */
/* DOLAR SECTION             */
/* ========================= */

#dolar {
    margin-top: 12px;
    width: 100%;
}

hr {
    width: min(15%, 120px);
    border-color: rgba(104, 211, 145, 0.3);
}

/* Flex centrado: tarjetas sobrantes en la última fila quedan al medio */
.container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
    padding: 16px clamp(12px, 4vw, 48px) 80px;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

/* ========================= */
/* ARTICLE / CARD            */
/* ========================= */

article {
    position: relative;
    flex: 0 0 300px;
    transition: transform 0.3s ease;
}

article::before {
    content: "";
    position: absolute;
    bottom: 0;
    height: 100%;
    width: 100%;
    background-color: var(--card-hover-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

article:hover {
    transform: perspective(300px) rotateX(8deg) translateY(-4%) translateZ(0);
}

article:hover::before {
    opacity: 1;
}

article:hover .cardHidden:last-child {
    opacity: 1;
    transform: translateY(10%);
}

/* Altura fija: el contenido no deforma la tarjeta */
.card {
    width: 100%;
    height: 130px;
    overflow: hidden;
    padding: clamp(8px, 2vw, 16px);
    text-align: center;
    background-color: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* ========================= */
/* CARD CONTENT              */
/* ========================= */

.dolar {
    font-size: clamp(0.85rem, 2.8vw, 1.5rem);
    color: var(--dolar-color);
    text-shadow: 0 0 8px #000;
    margin: 2px 0 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.source {
    margin: 0;
    padding-bottom: 6px;
    font-size: clamp(0.55rem, 1.4vw, 0.78rem);
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.price {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    min-width: 0;
    gap: 2px;
}

.separator {
    border-left: 1px solid #000;
    height: 30px;
    flex-shrink: 0;
    margin: 0 6px;
}

.sell, .buy {
    font-size: clamp(0.6rem, 1.6vw, 0.9rem);
    color: #000;
    line-height: 1.4;
    min-width: 0;
    overflow: hidden;
}

#buyPrice,
#sellPrice {
    font-size: clamp(0.55rem, 1.4vw, 0.82rem);
    color: var(--price-color);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.coin {
    font-size: clamp(0.5rem, 1.2vw, 0.75rem);
    color: var(--accent-bright);
}

/* ========================= */
/* CARD HIDDEN (HOVER PANEL) */
/* ========================= */

.cardHidden {
    text-align: center;
    padding-bottom: 40px;
}

article .cardHidden:last-child {
    position: absolute;
    width: calc(100% - 20px);
    max-width: 220px;
    bottom: 0;
    left: 0;
    right: 0;
    margin: auto;
    transform: translateY(25%);
    transition: opacity 0.3s ease, transform 0.3s ease;
    opacity: 0;
    font-size: clamp(0.65rem, 1.6vw, 0.85rem);
    color: var(--text-light);
}

#lastUpdate {
    color: wheat;
    font-size: clamp(0.65rem, 1.6vw, 0.85rem);
}

/* ========================= */
/* FOOTER                    */
/* ========================= */

footer {
    text-align: center;
    padding: 20px 16px 28px;
    font-size: clamp(0.65rem, 1.5vw, 0.85rem);
    color: var(--text-light);
    font-family: sans-serif;
}

footer a {
    text-decoration: none;
    color: #3391ff;
}

/* ========================= */
/* TABLET  ≤ 900px           */
/* ========================= */

@media screen and (max-width: 900px) {
    article {
        flex: 0 0 180px;
    }
}

/* ========================= */
/* MOBILE  ≤ 600px           */
/* ========================= */

@media screen and (max-width: 600px) {
    :root {
        --header-height: 56px;
    }

    #marketText {
        font-size: clamp(1.4rem, 7vw, 2rem);
    }

    /* Lista vertical, tarjetas centradas horizontalmente */
    .container {
        flex-direction: column;
        align-items: center;
        gap: 8px;
        padding: 12px 16px 60px;
    }

    /* Cada tarjeta ocupa el ancho disponible hasta 420px */
    article {
        flex: unset;
        width: 100%;
        max-width: 420px;
    }

    /* ---- Tarjeta modo fila ---- */
    /* Nombre a la izquierda, fuente en medio, precios a la derecha */
    .card {
        height: auto;
        min-height: unset;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: 10px 14px;
        gap: 6px;
        overflow: hidden;
    }

    .dolar {
        flex: 0 1 auto;
        max-width: 36%;
        text-align: left;
        font-size: clamp(0.78rem, 3.6vw, 1rem);
        margin: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .source {
        flex: 0 1 auto;
        max-width: 26%;
        text-align: left;
        font-size: clamp(0.5rem, 2.2vw, 0.68rem);
        padding-bottom: 0;
        margin: 0 2px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        color: rgba(232, 230, 227, 0.65);
    }

    .price {
        flex: 0 0 auto;
        justify-content: flex-end;
        overflow: visible;
        gap: 2px;
    }

    .sell, .buy {
        font-size: clamp(0.6rem, 2.8vw, 0.84rem);
        line-height: 1.35;
    }

    #buyPrice,
    #sellPrice {
        font-size: clamp(0.58rem, 2.6vw, 0.8rem);
        white-space: nowrap;
    }

    .coin {
        font-size: clamp(0.48rem, 2vw, 0.64rem);
    }

    .separator {
        height: 26px;
        margin: 0 5px;
        flex-shrink: 0;
    }

    /* Sin panel de hover en touch */
    .cardHidden {
        display: none;
    }

    article:hover {
        transform: none;
    }

    article:hover::before {
        opacity: 0;
    }

    /* Converter en columna */
    .converterForm {
        flex-direction: column;
        align-items: stretch;
    }

    .converterForm input,
    .converterForm select,
    .converterForm button {
        width: 100%;
        flex: unset;
    }

    footer {
        padding: 16px 16px 24px;
        font-size: 3vw;
    }
}

/* Teléfonos muy pequeños */
@media screen and (max-width: 360px) {
    .container {
        padding: 8px 10px 48px;
    }

    article {
        max-width: 100%;
    }
}