/* ==========================================================================
   etiquetaregalo.corbatalab.com — estilos
   Paleta: fondo #F8F1E7 · texto #2B2118 · acento #9B1C31 · secundario #1F4E5F
   ========================================================================== */

/* ---------- 1. Tokens ---------- */
:root {
  --fondo: #F8F1E7;
  --texto: #2B2118;
  --acento: #9B1C31;
  --acento-osc: #7C1426;
  --secundario: #1F4E5F;
  --tarjeta: #FFFCF7;
  --borde: #E5D7C4;
  --suave: #6B5B4C;
  --sombra: 0 1px 2px rgba(43, 33, 24, .06), 0 10px 30px -12px rgba(43, 33, 24, .22);
  --radio: 14px;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
}

/* ---------- 2. Reset mínimo ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--texto);
  background-color: var(--fondo);
  /* Papel kraft muy suave: fibras finas con un filtro SVG en línea */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .55 0 0 0 0 .4 0 0 0 0 .25 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
img, svg, canvas { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
p { margin: 0; }
a { color: var(--secundario); }
code { font-size: .9em; background: #F1E6D6; padding: .05em .35em; border-radius: 4px; }
:focus-visible { outline: 3px solid var(--secundario); outline-offset: 2px; }

.saltar { position: absolute; left: -999px; top: 8px; background: var(--texto); color: #fff; padding: 8px 12px; border-radius: 8px; z-index: 50; }
.saltar:focus { left: 8px; }

/* ---------- 3. Cabecera con lazo ---------- */
.cabecera { background: rgba(255, 252, 247, .78); backdrop-filter: blur(4px); position: relative; }
.cabecera__in { max-width: 1160px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.marca { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--texto); }
.marca__lazo { width: 40px; height: 27px; }
.marca__txt { font-family: var(--serif); font-weight: 700; font-size: 1.2rem; letter-spacing: .01em; }
.cabecera__nav { display: flex; gap: 18px; font-size: .92rem; }
.cabecera__nav a { color: var(--texto); text-decoration: none; }
.cabecera__nav a:hover { color: var(--acento); }
.cinta { height: 5px; background: linear-gradient(var(--acento), var(--acento)) top/100% 3px no-repeat, linear-gradient(var(--acento-osc), var(--acento-osc)) bottom/100% 2px no-repeat; }

/* ---------- 4. Intro ---------- */
.intro { max-width: 1160px; margin: 0 auto; padding: 22px 16px 14px; }
.intro h1 { font-family: var(--serif); font-size: clamp(1.45rem, 1.05rem + 1.9vw, 2.35rem); font-weight: 700; max-width: 34ch; }
.intro__sub { margin-top: 8px; color: var(--suave); max-width: 62ch; }

/* ---------- 5. Herramienta ---------- */
.herramienta {
  max-width: 1160px; margin: 0 auto; padding: 0 16px;
  display: grid; gap: 18px;
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 900px) {
  .herramienta { grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); align-items: start; }
  .panel--previa { position: sticky; top: 12px; }
}
.panel { background: var(--tarjeta); border: 1px solid var(--borde); border-radius: var(--radio); box-shadow: var(--sombra); padding: 16px; }
.aviso-js { background: #FFF1D6; border: 1px solid #E8C98F; padding: 12px; border-radius: 10px; margin-bottom: 12px; }

.campo { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
.campo__titulo { display: block; font-weight: 700; font-size: .95rem; margin-bottom: 7px; padding: 0; }
.campo__ayuda { display: block; font-weight: 400; color: var(--suave); font-size: .85rem; margin-top: 2px; }

textarea {
  width: 100%; resize: vertical; min-height: 150px;
  border: 1px solid var(--borde); border-radius: 10px; padding: 10px 12px;
  background: #fff; font-size: .95rem; line-height: 1.5;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}
textarea:focus { border-color: var(--secundario); outline: none; box-shadow: 0 0 0 3px rgba(31, 78, 95, .18); }
.lista__pie { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 12px; margin-top: 6px; align-items: baseline; }
.lista__info { font-size: .85rem; color: var(--suave); }
.lista__info strong { color: var(--texto); }
.lista__acciones { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.enlace { background: none; border: 0; padding: 2px 0; color: var(--secundario); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: .86rem; }
.enlace--sutil { color: var(--suave); }

/* Tipos */
.tipos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tipo { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; padding: 10px 6px 9px; border: 1.5px solid var(--borde); border-radius: 12px; background: #fff; cursor: pointer; color: var(--suave); transition: border-color .15s, background .15s; }
.tipo input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.tipo__dibujo { width: 54px; height: 30px; }
.tipo__nombre { font-weight: 700; font-size: .88rem; color: var(--texto); line-height: 1.2; }
.tipo__medida { font-size: .72rem; line-height: 1.25; }
.tipo:has(input:checked) { border-color: var(--acento); background: #FCF2F3; color: var(--acento); }
.tipo:has(input:focus-visible) { outline: 3px solid var(--secundario); outline-offset: 2px; }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { position: relative; display: inline-flex; align-items: center; gap: 6px; border: 1.5px solid var(--borde); background: #fff; border-radius: 999px; padding: 6px 12px; font-size: .88rem; cursor: pointer; }
.chip input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; }
.chip:has(input:checked) { border-color: var(--acento); background: var(--acento); color: #fff; }
.chip:has(input:focus-visible) { outline: 3px solid var(--secundario); outline-offset: 2px; }
.chips--iconos .chip { padding: 5px 10px 5px 6px; }
.chip canvas { width: 22px; height: 22px; }
.chip:has(input:checked) canvas { filter: brightness(0) invert(1); }

/* Colores */
.colores { display: flex; flex-wrap: wrap; gap: 8px; }
.color { position: relative; width: 34px; height: 34px; border-radius: 50%; cursor: pointer; box-shadow: inset 0 0 0 3px #fff, 0 0 0 1.5px var(--borde); }
.color input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; }
.color:has(input:checked) { box-shadow: inset 0 0 0 3px #fff, 0 0 0 3px var(--texto); }
.color:has(input:focus-visible) { outline: 3px solid var(--secundario); outline-offset: 3px; }

.fila-campos { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; }
select { width: 100%; border: 1px solid var(--borde); border-radius: 10px; padding: 9px 10px; background: #fff; }
.segmento { display: inline-flex; border: 1px solid var(--borde); border-radius: 10px; overflow: hidden; background: #fff; }
.segmento label { position: relative; }
.segmento input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmento span { display: block; padding: 9px 16px; font-size: .92rem; }
.segmento label:has(input:checked) span { background: var(--secundario); color: #fff; }
.segmento label:has(input:focus-visible) span { outline: 3px solid var(--acento); outline-offset: -3px; }

.interruptores { display: flex; flex-wrap: wrap; gap: 10px 22px; }
.interruptor { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: .92rem; }
.interruptor input { width: 18px; height: 18px; accent-color: var(--acento); }

/* Vista previa */
.previa__cabeza { margin-bottom: 10px; }
.contador { font-family: var(--serif); font-size: 1.45rem; font-weight: 700; }
.contador__sub { color: var(--suave); font-size: .86rem; }
.previa__pieza { background: #EFE3D2; border-radius: 10px; padding: 14px; display: flex; justify-content: center; }
.previa__pieza canvas { width: 100%; height: auto; max-height: 300px; object-fit: contain; filter: drop-shadow(0 4px 10px rgba(43, 33, 24, .2)); }

.descargas { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 11px; padding: 12px 18px; font-weight: 700; cursor: pointer; border: 0; text-decoration: none; transition: transform .08s, background .15s; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 20px; height: 20px; }
.btn--principal { background: var(--acento); color: #fff; flex: 1 1 220px; font-size: 1.04rem; min-height: 50px; }
.btn--principal:hover { background: var(--acento-osc); }
.btn--secundario { background: #fff; color: var(--secundario); border: 1.5px solid var(--secundario); }
.btn--secundario:hover { background: #EEF4F5; }
.btn[disabled] { opacity: .55; cursor: progress; }
.estado { min-height: 1.2em; font-size: .88rem; color: var(--secundario); margin-top: 8px; }
.estado.es-error { color: #A11A1A; }

.avisos { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.avisos li { background: #FDECEC; border: 1px solid #F0B9B9; color: #7A1414; border-radius: 9px; padding: 7px 10px; font-size: .86rem; }
.avisos li.es-info { background: #EEF4F5; border-color: #BFD3D8; color: var(--secundario); }

.hoja { margin-top: 14px; }
.hoja__barra { display: flex; align-items: center; justify-content: center; gap: 12px; font-size: .9rem; margin-bottom: 8px; color: var(--suave); }
.hoja__btn { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--borde); background: #fff; cursor: pointer; font-size: 1.2rem; line-height: 1; }
.hoja__btn[disabled] { opacity: .35; cursor: default; }
.hoja canvas { margin: 0 auto; width: 100%; max-width: 360px; height: auto; background: #fff; box-shadow: 0 2px 12px rgba(43, 33, 24, .18); border-radius: 2px; }

.privado { display: flex; gap: 8px; align-items: flex-start; margin-top: 14px; font-size: .86rem; color: var(--secundario); font-weight: 600; }
.privado svg { width: 16px; height: 16px; flex: 0 0 auto; margin-top: 2px; }
.limites { font-size: .8rem; color: var(--suave); margin-top: 4px; }

/* Móvil: primero la lista, luego la vista previa con la descarga, después las opciones */
@media (max-width: 899px) {
  .herramienta { display: flex; flex-direction: column; }
  .panel--lista { display: contents; }
  .panel--lista > .campo:first-child, .panel--lista > fieldset.campo, .opciones {
    background: var(--tarjeta); border: 1px solid var(--borde); border-radius: var(--radio); box-shadow: var(--sombra); padding: 14px; margin: 0;
  }
  .panel--lista > .campo:first-child { order: 1; }
  .panel--lista > fieldset.campo { order: 2; }
  .panel--previa { order: 3; }
  .opciones { order: 4; }
  .opciones > .campo:last-child { margin-bottom: 0; }
  textarea { min-height: 128px; }
}
@media (max-width: 420px) {
  .tipo__medida { font-size: .66rem; }
  .cabecera__nav a:not(:last-child) { display: none; }
  .fila-campos { grid-template-columns: 1fr; }
}

/* ---------- 6. Anuncios (huecos) ---------- */
.ad-slot { max-width: 1160px; margin: 26px auto; padding: 0 16px; }
.ad-slot > span { display: flex; align-items: center; justify-content: center; min-height: 100px; border: 1.5px dashed #CDBBA4; border-radius: 10px; color: #8A7660; font-size: .78rem; letter-spacing: .2em; background: rgba(255, 252, 247, .6); }
.ad-slot--contenido > span { min-height: 250px; }
.ad-slot--pop { margin: 12px 0; padding: 0; }
.ad-slot--pop > span { min-height: 250px; }

.pop { border: 0; padding: 0; background: transparent; max-width: min(420px, calc(100vw - 32px)); width: 100%; }
.pop::backdrop { background: rgba(43, 33, 24, .55); }
.pop__caja { position: relative; background: var(--tarjeta); border-radius: var(--radio); padding: 20px 18px 18px; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); text-align: center; }
.pop__tit { font-weight: 700; color: var(--secundario); padding-right: 28px; }
.pop__x { position: absolute; top: 8px; right: 8px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: #F1E6D6; font-size: 1.4rem; line-height: 1; cursor: pointer; }
.pop .btn { width: 100%; }

.toast { position: fixed; right: 14px; bottom: 14px; z-index: 40; width: 220px; background: var(--tarjeta); border: 1px solid var(--borde); border-radius: 12px; box-shadow: var(--sombra); padding: 10px; }
.toast span { display: flex; align-items: center; justify-content: center; min-height: 70px; border: 1.5px dashed #CDBBA4; border-radius: 8px; color: #8A7660; font-size: .72rem; letter-spacing: .2em; }
.toast__x { position: absolute; top: -10px; right: -10px; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--borde); background: #fff; cursor: pointer; line-height: 1; font-size: 1.1rem; }

/* ---------- 7. Contenido ---------- */
.seccion { max-width: 860px; margin: 0 auto; padding: 28px 16px; }
.seccion h2 { font-family: var(--serif); font-size: clamp(1.3rem, 1.05rem + 1vw, 1.7rem); margin-bottom: 14px; }
.texto h2 { margin-top: 26px; }
.texto h2:first-child { margin-top: 0; }
.texto p + p { margin-top: 12px; }
.pasos { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.pasos li { background: var(--tarjeta); border: 1px solid var(--borde); border-radius: var(--radio); padding: 16px; }
.pasos__n { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--acento); color: #fff; font-weight: 700; margin-bottom: 8px; }
.pasos h3 { font-size: 1.05rem; margin-bottom: 4px; }
.pasos p { font-size: .94rem; color: var(--suave); }
.ideas { padding-left: 1.1em; display: grid; gap: 8px; margin: 0; }
.faq details { background: var(--tarjeta); border: 1px solid var(--borde); border-radius: 12px; padding: 0 14px; margin-bottom: 8px; }
.faq summary { cursor: pointer; padding: 13px 0; font-weight: 700; list-style-position: outside; }
.faq details p { padding: 0 0 14px; color: var(--suave); }
.mas__lista { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.mas__item { display: block; background: var(--tarjeta); border: 1px solid var(--borde); border-radius: 12px; padding: 14px; text-decoration: none; color: var(--texto); }
.mas__item:hover { border-color: var(--acento); }
.mas__item span { display: block; color: var(--suave); font-size: .9rem; margin-top: 2px; }

/* Páginas legales */
.legal { max-width: 760px; margin: 0 auto; padding: 28px 16px 40px; }
.legal h1 { font-family: var(--serif); font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.1rem); margin-bottom: 8px; }
.legal h2 { font-family: var(--serif); font-size: 1.25rem; margin: 26px 0 8px; }
.legal p, .legal li { color: #3E3125; }
.legal p + p { margin-top: 10px; }
.legal ul { padding-left: 1.2em; }
.legal .fecha { color: var(--suave); font-size: .9rem; }
.legal .volver { display: inline-block; margin-top: 26px; font-weight: 700; }

/* ---------- 8. Pie ---------- */
.pie { margin-top: 30px; background: var(--texto); color: #EADFCF; }
.pie__in { max-width: 1160px; margin: 0 auto; padding: 26px 16px 30px; display: grid; gap: 10px; }
.pie__marca { font-family: var(--serif); font-weight: 700; font-size: 1.5rem; color: #fff; text-decoration: none; letter-spacing: .01em; display: inline-flex; align-items: center; gap: 8px; }
.pie__marca::before { content: ""; width: 12px; height: 12px; background: #D9475E; border-radius: 3px; transform: rotate(45deg); }
.pie__txt { font-size: .9rem; color: #CDBFAC; }
.pie__nav { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.pie__nav a { color: #F3E9DC; font-size: .92rem; }
.pie__copy { font-size: .8rem; color: #A8998A; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn, .tipo { transition: none; }
}
@media print {
  .cabecera, .ad-slot, .pie, .toast, .pop { display: none !important; }
}

/* Las leyendas de fieldset no se montan sobre el borde de la tarjeta */
legend.campo__titulo { float: left; width: 100%; }
legend.campo__titulo + * { clear: both; }
