/* =========================================================
   Atelier 3D — muestrario de colección
   ========================================================= */

:root {
    --fondo:          #131316;
    --panel:          #191920;
    --elevado:        #212129;
    --elevado-alto:   #2b2b34;
    --borde:          rgba(255, 255, 255, 0.08);
    --borde-fuerte:   rgba(255, 255, 255, 0.16);

    --texto:          #e9e6e1;
    --texto-medio:    #a8a49c;
    --texto-tenue:    #6f6c66;

    --acento:         #c9a961;
    --acento-claro:   #dcc084;
    --acento-velo:    rgba(201, 169, 97, 0.14);

    --radio:          14px;
    --radio-chico:    9px;
    --sombra:         0 18px 45px rgba(0, 0, 0, 0.45);
    --transicion:     180ms cubic-bezier(0.4, 0, 0.2, 1);

    --panel-ancho-izq: 264px;
    --panel-ancho-der: 300px;

    color-scheme: dark;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    background: var(--fondo);
    color: var(--texto);
    font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

h1, h2, h3 {
    margin: 0;
    font-weight: 600;
    letter-spacing: -0.01em;
}

button {
    font: inherit;
    color: inherit;
}

:focus-visible {
    outline: 2px solid var(--acento);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ---------- Estructura ---------- */

.app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
}

.taller {
    flex: 1;
    display: grid;
    grid-template-columns: var(--panel-ancho-izq) minmax(0, 1fr) var(--panel-ancho-der);
    gap: 16px;
    padding: 16px;
    align-items: stretch;
    min-height: 0;
}

/* ---------- Cabecera ---------- */

.cabecera {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 22px;
    border-bottom: 1px solid var(--borde);
    background: linear-gradient(180deg, #17171d, #131316);
}

.cabecera__marca {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cabecera__logo {
    width: 34px;
    height: 34px;
    flex: none;
    border-radius: 10px;
    background:
        radial-gradient(circle at 32% 28%, var(--acento-claro), var(--acento) 45%, #8a6f34 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 4px 14px rgba(201, 169, 97, 0.25);
}

.cabecera__nombre {
    margin: 0;
    font-size: 16px;
    font-weight: 650;
    letter-spacing: 0.03em;
}

.cabecera__lema {
    margin: 0;
    font-size: 12px;
    color: var(--texto-tenue);
}

.cabecera__acciones {
    display: flex;
    align-items: center;
    gap: 12px;
}

.etiqueta {
    padding: 3px 10px;
    border: 1px solid var(--acento);
    border-radius: 999px;
    color: var(--acento-claro);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

/* ---------- Paneles ---------- */

.panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 18px 16px;
    border: 1px solid var(--borde);
    border-radius: var(--radio);
    background: var(--panel);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.panel__titulo {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--texto-medio);
}

.panel__ayuda {
    margin: 6px 0 18px;
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--texto-tenue);
}

/* ---------- Catálogo ---------- */

.catalogo {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.prenda {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px;
    border: 1px solid transparent;
    border-radius: var(--radio-chico);
    background: transparent;
    text-align: left;
    cursor: pointer;
    transition: background var(--transicion), border-color var(--transicion);
}

.prenda:hover {
    background: var(--elevado);
}

.prenda--activa {
    border-color: var(--borde-fuerte);
    background: var(--elevado);
}

.prenda__muestra {
    width: 38px;
    height: 38px;
    flex: none;
    border-radius: 8px;
    background-color: var(--texto-tenue);
    background: var(--elevado-alto);
    display: grid;
    place-items: center;
    transition: background var(--transicion);
}

.prenda__muestra::after {
    content: "";
    width: 22px;
    height: 22px;
    background-color: var(--texto-medio);
    transition: background-color var(--transicion);
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-size: contain;
    mask-size: contain;
}

.prenda--activa .prenda__muestra {
    background: var(--acento-velo);
}

.prenda--activa .prenda__muestra::after {
    background-color: var(--acento-claro);
}

/* Glifos de silueta (SVG embebido, sin peticiones externas) */
.prenda__muestra[data-silueta="camiseta"]::after {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linejoin='round'%3E%3Cpath d='M8.5 3 4 5.2 2.2 9.2l3 1.3V21h13.6V10.5l3-1.3L20 5.2 15.5 3c0 1.6-1.6 2.7-3.5 2.7S8.5 4.6 8.5 3Z'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linejoin='round'%3E%3Cpath d='M8.5 3 4 5.2 2.2 9.2l3 1.3V21h13.6V10.5l3-1.3L20 5.2 15.5 3c0 1.6-1.6 2.7-3.5 2.7S8.5 4.6 8.5 3Z'/%3E%3C/svg%3E");
}

.prenda__muestra[data-silueta="hoodie"]::after {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linejoin='round'%3E%3Cpath d='M8.5 3 4 5.2 2.2 9.2l3 1.3V21h13.6V10.5l3-1.3L20 5.2 15.5 3'/%3E%3Cpath d='M8.5 3c0 2.9 1.6 4.6 3.5 4.6S15.5 5.9 15.5 3'/%3E%3Cpath d='M12 8.4v4'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linejoin='round'%3E%3Cpath d='M8.5 3 4 5.2 2.2 9.2l3 1.3V21h13.6V10.5l3-1.3L20 5.2 15.5 3'/%3E%3Cpath d='M8.5 3c0 2.9 1.6 4.6 3.5 4.6S15.5 5.9 15.5 3'/%3E%3Cpath d='M12 8.4v4'/%3E%3C/svg%3E");
}

.prenda__muestra[data-silueta="vestido"]::after {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linejoin='round'%3E%3Cpath d='M9 3 5.6 5 4.2 8.8l3 1.4L4.6 21h14.8l-2.6-10.8 3-1.4L18.4 5 15 3c0 1.4-1.3 2.4-3 2.4S9 4.4 9 3Z'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linejoin='round'%3E%3Cpath d='M9 3 5.6 5 4.2 8.8l3 1.4L4.6 21h14.8l-2.6-10.8 3-1.4L18.4 5 15 3c0 1.4-1.3 2.4-3 2.4S9 4.4 9 3Z'/%3E%3C/svg%3E");
}

.prenda__muestra[data-silueta="pantalon"]::after {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linejoin='round'%3E%3Cpath d='M6.2 3h11.6l-.7 18h-4.2L12 11.2 11.1 21H6.9Z'/%3E%3Cpath d='M6.2 6.4h11.6'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linejoin='round'%3E%3Cpath d='M6.2 3h11.6l-.7 18h-4.2L12 11.2 11.1 21H6.9Z'/%3E%3Cpath d='M6.2 6.4h11.6'/%3E%3C/svg%3E");
}

.prenda__muestra[data-silueta="chaqueta"]::after {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linejoin='round'%3E%3Cpath d='M8.5 3 4 5.2 2.2 9.2l3 1.3V21h13.6V10.5l3-1.3L20 5.2 15.5 3'/%3E%3Cpath d='M8.5 3 12 6.6 15.5 3'/%3E%3Cpath d='M12 6.6V21'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linejoin='round'%3E%3Cpath d='M8.5 3 4 5.2 2.2 9.2l3 1.3V21h13.6V10.5l3-1.3L20 5.2 15.5 3'/%3E%3Cpath d='M8.5 3 12 6.6 15.5 3'/%3E%3Cpath d='M12 6.6V21'/%3E%3C/svg%3E");
}

.prenda__muestra[data-silueta="falda"]::after {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linejoin='round'%3E%3Cpath d='M7 4h10l4 16H3Z'/%3E%3Cpath d='M7 4h10'/%3E%3Cpath d='M7 7.4h10'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linejoin='round'%3E%3Cpath d='M7 4h10l4 16H3Z'/%3E%3Cpath d='M7 4h10'/%3E%3Cpath d='M7 7.4h10'/%3E%3C/svg%3E");
}

.prenda__texto {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.prenda__nombre {
    font-size: 13.5px;
    font-weight: 550;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.prenda__meta {
    font-size: 11.5px;
    color: var(--texto-tenue);
}

/* ---------- Escena 3D ---------- */

.escena {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
    min-height: 0;
}

.escena__lienzo {
    position: relative;
    flex: 1;
    min-height: 340px;
    border: 1px solid var(--borde);
    border-radius: var(--radio);
    background:
        radial-gradient(ellipse 70% 55% at 50% 42%, #2a2a33 0%, #1a1a20 55%, #131316 100%);
    box-shadow: var(--sombra);
    overflow: hidden;
    cursor: grab;
    touch-action: none;
}

.escena__lienzo:active {
    cursor: grabbing;
}

.escena__lienzo canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.escena__estado {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    background: var(--fondo);
    color: var(--texto-medio);
    font-size: 13px;
    transition: opacity 400ms ease, visibility 400ms;
}

.escena__estado[hidden] {
    display: flex;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.escena__estado--error {
    color: #e6a08c;
    padding: 24px;
    text-align: center;
}

.escena__spinner {
    width: 26px;
    height: 26px;
    border: 2px solid var(--borde-fuerte);
    border-top-color: var(--acento);
    border-radius: 50%;
    animation: girar 800ms linear infinite;
}

.escena__estado--error .escena__spinner {
    display: none;
}

@keyframes girar {
    to { transform: rotate(360deg); }
}

.escena__barra {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    padding: 0 4px 2px;
}

.escena__titulo h1 {
    font-size: 21px;
    letter-spacing: -0.02em;
}

.escena__titulo p {
    margin: 5px 0 0;
    max-width: 62ch;
    font-size: 13px;
    line-height: 1.6;
    color: var(--texto-medio);
}

.escena__botones {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ---------- Botones ---------- */

.boton {
    padding: 8px 15px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: var(--acento);
    color: #221b0a;
    font-size: 12.5px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: background var(--transicion), border-color var(--transicion),
                color var(--transicion), transform var(--transicion);
}

.boton:hover {
    background: var(--acento-claro);
}

.boton:active {
    transform: translateY(1px);
}

.boton--fantasma {
    background: transparent;
    border-color: var(--borde-fuerte);
    color: var(--texto-medio);
}

.boton--fantasma:hover {
    background: var(--elevado);
    color: var(--texto);
}

.boton--fantasma[aria-pressed="true"] {
    border-color: var(--acento);
    color: var(--acento-claro);
    background: var(--acento-velo);
}

/* ---------- Grupos de ajustes ---------- */

.grupo + .grupo {
    margin-top: 24px;
    padding-top: 22px;
    border-top: 1px solid var(--borde);
}

.grupo__titulo {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
    font-size: 12px;
    font-weight: 650;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--texto-medio);
}

.grupo__valor {
    font-size: 11.5px;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
    color: var(--texto-tenue);
}

/* Muestras de color */

.muestras {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
    gap: 8px;
}

.muestra {
    position: relative;
    aspect-ratio: 1;
    padding: 0;
    border: 1px solid var(--borde-fuerte);
    border-radius: 8px;
    cursor: pointer;
    transition: transform var(--transicion), box-shadow var(--transicion);
}

.muestra:hover {
    transform: scale(1.07);
}

.muestra--activa {
    box-shadow: 0 0 0 2px var(--fondo), 0 0 0 4px var(--acento);
}

.muestra--activa::after {
    content: "";
    position: absolute;
    inset: 0;
    margin: auto;
    width: 11px;
    height: 7px;
    border-left: 2px solid;
    border-bottom: 2px solid;
    border-color: inherit;
    transform: rotate(-45deg) translate(1px, -2px);
}

/* Opciones de textura */

.opciones {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.opcion {
    padding: 6px 13px;
    border: 1px solid var(--borde-fuerte);
    border-radius: 999px;
    background: transparent;
    color: var(--texto-medio);
    font-size: 12.5px;
    cursor: pointer;
    transition: background var(--transicion), border-color var(--transicion),
                color var(--transicion);
}

.opcion:hover {
    background: var(--elevado);
    color: var(--texto);
}

.opcion--activa {
    border-color: var(--acento);
    background: var(--acento-velo);
    color: var(--acento-claro);
}

/* Ficha técnica del tejido */

.ficha {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 9px 16px;
    margin: 0;
    font-size: 12.5px;
}

.ficha dt {
    color: var(--texto-tenue);
}

.ficha dd {
    margin: 0;
    text-align: right;
    color: var(--texto);
}

.barra {
    height: 4px;
    margin-top: 6px;
    border-radius: 999px;
    background: var(--elevado-alto);
    overflow: hidden;
}

.barra span {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--acento), var(--acento-claro));
    transition: width 300ms ease;
}

/* ---------- Renders editoriales ---------- */

.editorial {
    padding: 10px 22px 28px;
    border-top: 1px solid var(--borde);
}

.editorial__encabezado {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 28px;
    max-width: 1240px;
    margin: 0 auto 18px;
}

.editorial__eyebrow {
    margin: 0 0 5px;
    color: var(--acento-claro);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.editorial__encabezado h2 {
    margin: 0;
    color: var(--texto);
    font-size: clamp(22px, 3vw, 34px);
    letter-spacing: -0.035em;
}

.editorial__encabezado > p {
    max-width: 455px;
    margin: 0;
    color: var(--texto-medio);
    font-size: 13px;
    line-height: 1.55;
}

.editorial__grilla {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    max-width: 1240px;
    margin: 0 auto;
}

.editorial__tarjeta {
    position: relative;
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--borde);
    border-radius: 14px;
    background: #111115;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
}

.editorial__imagen {
    display: block;
    width: 100%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    transition: transform 500ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.editorial__tarjeta:hover .editorial__imagen {
    transform: scale(1.025);
}

.editorial__pie {
    position: absolute;
    inset: auto 0 0;
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 12px;
    padding: 50px 15px 14px;
    background: linear-gradient(transparent, rgba(9, 9, 12, 0.96) 68%);
}

.editorial__tipo {
    margin: 0 0 3px;
    color: var(--acento-claro);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.editorial__pie h3 {
    margin: 0;
    color: #fffdf8;
    font-size: clamp(14px, 1.7vw, 18px);
    letter-spacing: -0.025em;
}

.editorial__accion {
    flex: 0 0 auto;
    padding: 8px 11px;
    border: 1px solid rgba(226, 193, 116, 0.72);
    border-radius: 999px;
    background: rgba(19, 18, 19, 0.72);
    color: #f9e5a7;
    font: inherit;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: background var(--transicion), color var(--transicion), transform var(--transicion);
}

.editorial__accion:hover {
    background: var(--acento);
    color: #18140c;
    transform: translateY(-1px);
}

.editorial__accion:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
}

/* ---------- Pie ---------- */

.pie {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 14px 22px;
    border-top: 1px solid var(--borde);
    font-size: 11.5px;
    color: var(--texto-tenue);
}

.pie p {
    margin: 0;
}

.pie__tecnico {
    font-variant-numeric: tabular-nums;
}

/* ---------- Avisos ---------- */

.aviso {
    margin: 0;
    padding: 14px 22px;
    background: #3a2418;
    color: #e6b79c;
    font-size: 13px;
    text-align: center;
}

/* ---------- Adaptable ---------- */

@media (max-width: 1180px) {
    .taller {
        grid-template-columns: 220px minmax(0, 1fr) 260px;
    }
}

@media (max-width: 980px) {
    .taller {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "escena"
            "ajustes"
            "catalogo";
    }

    .escena              { grid-area: escena; }
    .panel--ajustes      { grid-area: ajustes; }
    .panel--catalogo     { grid-area: catalogo; }

    .panel {
        overflow: visible;
    }

    .escena__lienzo {
        min-height: 62vh;
    }

    .catalogo {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    }

    .editorial__grilla {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    .cabecera,
    .pie {
        padding: 12px 16px;
    }

    .taller {
        gap: 12px;
        padding: 12px;
    }

    .escena__barra {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }

    .escena__titulo h1 {
        font-size: 18px;
    }

    .editorial {
        padding: 8px 16px 22px;
    }

    .editorial__encabezado {
        align-items: start;
        flex-direction: column;
        gap: 8px;
    }

    .editorial__grilla {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
