/* ==========================================================================
   Foco Try-On · Probador Virtual AR + IA (v1.0.2)
   ========================================================================== */

.fto-app {
	--fto-prim: #00a29a;
	--fto-prim-2: #10a099;
	--fto-acento: #f4a300;
	--fto-osc: #0b2b33;
	--fto-gris: #776f74;
	--fto-radius: 18px;
	--fto-shadow: 0 14px 40px rgba(11, 43, 51, .14);
	--fto-font: 'Roboto', system-ui, sans-serif;
	--fto-font-display: 'Roboto Slab', serif;

	font-family: var(--fto-font);
	color: var(--fto-osc);
	background: #fff;
	border: 1px solid rgba(11,43,51,.08);
	border-radius: 26px;
	padding: clamp(22px, 3vw, 40px);
}

.fto-app__head { text-align: center; max-width: 720px; margin: 0 auto 28px; }
.fto-app__title { font-family: var(--fto-font-display); font-size: clamp(1.5rem, 3vw, 2.2rem); margin-bottom: .4em; }
.fto-app__desc { color: var(--fto-gris); margin: 0; }

.fto-app__layout { display: block; max-width: 980px; margin: 0 auto; }

.fto-app [hidden] { display: none !important; }

/* Visor */
.fto-app__stage {
	position: relative; border-radius: var(--fto-radius); overflow: hidden;
	background: radial-gradient(600px 400px at 50% 30%, #103c46, #071a1f 75%);
	aspect-ratio: 4 / 3;
	box-shadow: var(--fto-shadow);
}
.fto-app__stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); opacity: 0; transition: opacity .4s ease; }
.fto-app__stage.is-live video { opacity: 1; }
/* El canvas debe recibir EXACTAMENTE la misma transformación que el video
   (object-fit: cover); si no, el overlay se desalinea de la cara en móvil,
   donde el visor es vertical (3/4) y el stream de la cámara horizontal. */
.fto-app__stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
/* Ocultar los controles nativos del video (botón PiP / pantalla completa del
   navegador, que aparecen como un círculo flotante encima del visor). */
.fto-app__stage video::-webkit-media-controls { display: none !important; }

/* Pantalla completa (nativa o fallback fijo) */
.fto-app__stage.is-fake-full {
	position: fixed; inset: 0; z-index: 99990; border-radius: 0; aspect-ratio: auto;
	width: 100vw; height: 100vh; height: 100dvh;
}
.fto-app__stage:fullscreen { border-radius: 0; aspect-ratio: auto; background: #071a1f; }

/* Placeholder de inicio */
.fto-app__placeholder {
	position: absolute; inset: 0; z-index: 2;
	display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
	color: #fff; text-align: center; padding: 24px;
	transition: opacity .4s ease, visibility .4s;
}
.fto-app__stage.is-live .fto-app__placeholder { opacity: 0; visibility: hidden; }
.fto-app__placeholder-icon {
	font-size: 3rem; color: var(--fto-prim);
	width: 96px; height: 96px; display: grid; place-items: center;
	border-radius: 50%; border: 2px dashed rgba(0,194,184,.6);
	animation: fto-breathe 3s ease-in-out infinite;
}
@keyframes fto-breathe { 0%,100% { transform: scale(1); opacity: .9; } 50% { transform: scale(1.06); opacity: 1; } }
.fto-app__placeholder p { max-width: 40ch; margin: 0; color: rgba(255,255,255,.85); }

/* ---------- Efecto de escaneo facial ---------- */
.fto-scan {
	position: absolute; inset: 0; z-index: 9;
	display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
	background: rgba(7, 26, 31, .55);
	backdrop-filter: blur(2px);
	transition: opacity .5s ease, visibility .5s;
	padding-bottom: 40px; /* durante el escaneo no se ven monturas ni carrusel */
}
.fto-scan[hidden] { display: none; }
.fto-scan.is-done { opacity: 0; visibility: hidden; }
.fto-scan__frame {
	position: relative; width: min(58%, 320px); aspect-ratio: 3 / 4;
}
.fto-scan__corner {
	position: absolute; width: 34px; height: 34px;
	border: 3px solid var(--fto-prim-2);
	filter: drop-shadow(0 0 6px rgba(0,194,184,.8));
}
.fto-scan__corner--tl { top: 0; left: 0; border-right: 0; border-bottom: 0; border-radius: 10px 0 0 0; }
.fto-scan__corner--tr { top: 0; right: 0; border-left: 0; border-bottom: 0; border-radius: 0 10px 0 0; }
.fto-scan__corner--bl { bottom: 0; left: 0; border-right: 0; border-top: 0; border-radius: 0 0 0 10px; }
.fto-scan__corner--br { bottom: 0; right: 0; border-left: 0; border-top: 0; border-radius: 0 0 10px 0; }
.fto-scan__laser {
	position: absolute; left: 6%; right: 6%; height: 2px; top: 8%;
	background: linear-gradient(90deg, transparent, #54f0e4 20%, #b8fff8 50%, #54f0e4 80%, transparent);
	box-shadow: 0 0 14px 3px rgba(0, 226, 209, .55);
	animation: fto-laser 2.2s ease-in-out infinite;
}
@keyframes fto-laser { 0%, 100% { top: 10%; } 50% { top: 88%; } }
.fto-scan__grid {
	position: absolute; inset: 0; border-radius: 12px; overflow: hidden; opacity: .5;
	background-image:
		linear-gradient(rgba(0,226,209,.25) 1px, transparent 1px),
		linear-gradient(90deg, rgba(0,226,209,.25) 1px, transparent 1px);
	background-size: 22px 22px;
	mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
	-webkit-mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
	animation: fto-grid 4s linear infinite;
}
@keyframes fto-grid { from { background-position: 0 0, 0 0; } to { background-position: 0 22px, 22px 0; } }
.fto-scan__text {
	color: #eafffb; font-size: clamp(.95rem, 2.4vw, 1.15rem); font-weight: 600;
	letter-spacing: .12em; text-transform: uppercase; text-align: center;
	text-shadow: 0 0 12px rgba(0, 226, 209, .7);
	min-height: 1.4em; margin: 0;
}
.fto-scan__bar {
	width: min(58%, 320px); height: 6px; border-radius: 999px;
	background: rgba(255,255,255,.14); overflow: hidden;
}
.fto-scan__bar i {
	display: block; height: 100%; width: 0;
	background: linear-gradient(90deg, var(--fto-prim), #54f0e4);
	box-shadow: 0 0 10px rgba(0,226,209,.8);
	transition: width 1.1s cubic-bezier(.4,0,.2,1);
}
/* Selector de género (visible durante todo el escaneo) */
.fto-scan__gender { text-align: center; }
.fto-scan__gender[hidden] { display: none; }
.fto-scan__gender-label {
	margin: 0 0 10px; color: #eafffb; font-weight: 600;
	font-size: clamp(.95rem, 2.4vw, 1.1rem);
	text-shadow: 0 0 12px rgba(0, 226, 209, .7);
}
.fto-scan__gender-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.fto-gender-btn {
	appearance: none; cursor: pointer;
	border: 2px solid rgba(84, 240, 228, .55); border-radius: 999px;
	background: rgba(7, 26, 31, .68); color: #eafffb;
	padding: 10px 22px; font-size: .95rem; font-weight: 700; letter-spacing: .04em;
	backdrop-filter: blur(6px);
	transition: transform .15s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.fto-gender-btn:hover { transform: translateY(-2px); border-color: #54f0e4; }
.fto-gender-btn.is-active {
	background: linear-gradient(135deg, var(--fto-prim), #54f0e4);
	border-color: #b8fff8; color: #062226;
	box-shadow: 0 6px 18px rgba(0, 226, 209, .5);
}
/* Fila superior del carrusel: label + botón Ver todas */
.fto-strip__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.fto-ver-todas {
	appearance: none; flex: 0 0 auto; cursor: pointer;
	border: 1px solid rgba(84, 240, 228, .5); border-radius: 999px;
	background: rgba(7, 26, 31, .6); color: #8ff0e8;
	padding: 5px 14px; font-size: .78rem; font-weight: 700; letter-spacing: .05em;
	transition: background .15s ease, color .15s ease;
}
.fto-ver-todas:hover { background: rgba(0, 226, 209, .18); color: #eafffb; }
.fto-ver-todas.is-on { background: linear-gradient(135deg, var(--fto-prim), #54f0e4); color: #062226; border-color: transparent; }
.fto-ver-todas[hidden] { display: none; }

/* HUD de resultados */
.fto-app__hud {
	position: absolute; z-index: 4; left: 14px; top: 14px;
	display: flex; gap: 10px; flex-wrap: wrap;
}
.fto-hud__item {
	background: rgba(7, 26, 31, .72); backdrop-filter: blur(8px);
	border: 1px solid rgba(255,255,255,.16);
	color: #fff; border-radius: 12px; padding: 8px 14px;
	font-size: .8rem; line-height: 1.3;
}
.fto-hud__label { display: block; font-size: .66rem; letter-spacing: .14em; text-transform: uppercase; color: #8ff0e8; }
.fto-hud__item strong { font-size: .95rem; }

.fto-app__fps {
	position: absolute; z-index: 4; right: 64px; top: 14px;
	background: rgba(7,26,31,.6); color: rgba(255,255,255,.8);
	font-size: .68rem; padding: 4px 10px; border-radius: 8px;
}

/* Botones flotantes de acción (FAB). El fondo (bottom) deja la columna
   SIEMPRE por encima del carrusel (con su label reservado), sin montarse
   sobre el texto ni los chips. */
.fto-fabs {
	position: absolute; z-index: 7; right: 12px; bottom: 162px;
	display: flex; flex-direction: column; gap: 10px; align-items: flex-end;
}
.fto-fab-row { display: flex; gap: 10px; }
.fto-fab {
	width: 48px; height: 48px; border-radius: 50%; border: 1px solid rgba(255,255,255,.2);
	background: rgba(7, 26, 31, .78); backdrop-filter: blur(8px);
	color: #fff; font-size: 1.15rem; cursor: pointer;
	display: grid; place-items: center;
	transition: transform .25s ease, background .25s ease;
}
.fto-fab:hover { transform: scale(1.08); background: rgba(0, 162, 154, .85); }
.fto-fab--accent { background: linear-gradient(120deg, var(--fto-acento), #ffc14d); color: #3d2c00; border: 0; }
.fto-fab--accent:hover { background: linear-gradient(120deg, #ffc14d, var(--fto-acento)); }
.fto-fab--wide {
	width: auto; height: 48px; border-radius: 999px; padding: 0 16px; gap: 8px;
	font-size: .82rem; font-weight: 700; display: inline-flex; align-items: center;
}
.fto-fab.is-off { opacity: .55; }
.fto-fab__stop { font-size: .8rem; font-weight: 700; letter-spacing: .05em; }

.fto-stop-fab {
	position: absolute; z-index: 7; right: 12px; top: 12px;
	width: 40px; height: 40px; border-radius: 50%;
	border: 1px solid rgba(255,255,255,.25); background: rgba(7,26,31,.7);
	color: #fff; font-size: 1rem; cursor: pointer;
}

/* Carrusel de monturas dentro del visor */
.fto-strip {
	position: absolute; z-index: 5; left: 0; right: 0; bottom: 0;
	padding: 10px 12px 12px;
	background: linear-gradient(180deg, transparent, rgba(7,26,31,.82) 38%);
}
.fto-strip[hidden] { display: none; }
.fto-strip__label {
	color: #eafffb; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase;
	margin: 0 0 8px; text-shadow: 0 1px 6px rgba(0,0,0,.6);
	/* Reservar el espacio aunque esté vacío: evita que el carrusel "salte"
	   al aparecer el texto y que los FAB se monten sobre él. */
	min-height: 1.2em;
	/* El título NUNCA se corta con "…": si no cabe en una línea pasa a dos
	   (el tipo de rostro debe leerse completo). syncFabs() recalcula el
	   alto del carrusel tras cada cambio y los FAB suben con él, así que
	   la fila extra no tapa nada. */
	white-space: normal; overflow-wrap: break-word;
	flex: 1 1 auto; min-width: 0;
}
.fto-strip__label:empty { visibility: hidden; }
.fto-strip__label strong { color: #54f0e4; }
.fto-strip__scroll {
	display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none;
	padding-bottom: 2px;
}
.fto-strip__scroll::-webkit-scrollbar { display: none; }
.fto-chip {
	position: relative; flex: 0 0 auto; width: 92px;
	border: 2px solid rgba(255,255,255,.16); border-radius: 14px;
	background: rgba(255,255,255,.94); padding: 8px 6px 7px;
	text-align: center; cursor: pointer;
	transition: border-color .25s ease, transform .25s ease, box-shadow .25s ease;
	font-family: inherit;
}
.fto-chip:hover { transform: translateY(-3px); }
.fto-chip.is-active { border-color: var(--fto-prim); box-shadow: 0 8px 22px rgba(0,226,209,.45); }
.fto-chip img { width: 100%; height: 44px; object-fit: contain; margin-bottom: 5px; }
.fto-chip__name { font-size: .64rem; font-weight: 700; line-height: 1.2; display: block; color: var(--fto-osc); }
.fto-chip__badge {
	position: absolute; top: 4px; font-size: .52rem; font-weight: 800; letter-spacing: .05em;
	padding: 2px 6px; border-radius: 999px; text-transform: uppercase;
}
.fto-chip__badge--sol { left: 4px; background: var(--fto-acento); color: #3d2c00; }
.fto-chip__badge--ideal { right: 4px; background: var(--fto-prim); color: #fff; }

/* Hoja inferior con el formulario (tipo app) */
.fto-sheet {
	position: absolute; z-index: 8; left: 0; right: 0; bottom: 0;
	max-height: 78%; overflow-y: auto;
	background: rgba(255,255,255,.97); backdrop-filter: blur(10px);
	border-radius: 18px 18px 0 0; padding: 20px;
	transform: translateY(102%); transition: transform .35s cubic-bezier(.4,0,.2,1);
	box-shadow: 0 -18px 50px rgba(0,0,0,.35);
}
.fto-sheet[hidden] { display: none; }
.fto-sheet:not([hidden]) { transform: translateY(0); }
.fto-sheet__close {
	position: absolute; top: 10px; right: 14px; border: 0; background: none;
	font-size: 1.7rem; cursor: pointer; color: var(--fto-gris); line-height: 1;
}
.fto-sheet__title { font-family: var(--fto-font-display); font-size: 1.15rem; margin: 0 0 12px; }
.fto-app__lead-tip { font-size: .92rem; color: var(--fto-osc); margin: 0 0 14px; }
.fto-app__lead-tip strong { color: var(--fto-prim); }
.fto-app__lead-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.fto-app__lead input[type=text], .fto-app__lead input[type=email] {
	flex: 1; min-width: 180px; padding: .8em 1.1em; border-radius: 12px;
	border: 1px solid rgba(11,43,51,.16); font-size: .95rem; font-family: inherit;
}
.fto-app__lead input:focus { outline: none; border-color: var(--fto-prim); }
.fto-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }
.fto-app__lead-msg { margin: 10px 0 0; font-weight: 600; color: var(--fto-prim); min-height: 1.2em; }

/* Botones */
.fto-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: .5em;
	padding: .78em 1.6em; border-radius: 999px; border: 2px solid transparent;
	font-family: var(--fto-font); font-weight: 700; font-size: .92rem; cursor: pointer;
	background: rgba(11,43,51,.06); color: var(--fto-osc);
	transition: transform .3s ease, box-shadow .3s ease, background .3s ease, color .3s ease;
}
.fto-btn:hover { transform: translateY(-2px); }
.fto-btn--primary { background: linear-gradient(120deg, var(--fto-prim), #00c2b8); color: #fff; box-shadow: 0 10px 26px rgba(0,162,154,.35); }
.fto-btn--accent { background: linear-gradient(120deg, var(--fto-acento), #ffc14d); color: #3d2c00; box-shadow: 0 10px 26px rgba(244,163,0,.3); }
.fto-btn--ghost { background: transparent; border-color: rgba(11,43,51,.2); }
.fto-btn[disabled] { opacity: .55; cursor: wait; transform: none; }

.fto-app__privacy { font-size: .78rem; color: var(--fto-gris); margin-top: 16px; text-align: center; }

/* Modal captura */
.fto-app__shot {
	position: fixed; inset: 0; z-index: 99999; background: rgba(7,26,31,.85);
	display: flex; align-items: center; justify-content: center; padding: 4vw;
}
.fto-app__shot[hidden] { display: none; }
.fto-app__shot-box {
	position: relative; background: #fff; border-radius: 22px; padding: 26px;
	max-width: 640px; width: 100%; text-align: center; box-shadow: 0 40px 100px rgba(0,0,0,.5);
}
.fto-app__shot-box h3 { font-family: var(--fto-font-display); }
.fto-app__shot-box img { border-radius: 14px; margin: 0 auto 16px; max-height: 60vh; width: auto; }
.fto-app__shot-close {
	position: absolute; top: 12px; right: 16px; border: 0; background: none;
	font-size: 2rem; cursor: pointer; color: var(--fto-gris); line-height: 1;
}
.fto-app__shot-actions { display: flex; gap: 12px; justify-content: center; }

.fto-product-cta {
	display: inline-flex; align-items: center; gap: .5em;
	margin-top: 10px; padding: .8em 1.6em; border-radius: 999px;
	background: linear-gradient(120deg, #f4a300, #ffc14d); color: #3d2c00; font-weight: 700;
}
.fto-product-cta:hover { color: #3d2c00; }
.fto-empty { padding: 30px; text-align: center; }

/* Responsive: experiencia tipo app en celular */
@media (max-width: 980px) {
	.fto-app__stage { aspect-ratio: 3 / 4; }
	.fto-app__stage.is-fake-full { aspect-ratio: auto; }
}
@media (max-width: 620px) {
	.fto-app { padding: 14px; border-radius: 18px; }
	.fto-app__head { margin-bottom: 16px; }
	.fto-fabs { bottom: 162px; right: 10px; }
	.fto-chip { width: 82px; }
	.fto-app__hud { left: 10px; top: 10px; }
	.fto-hud__item { padding: 6px 10px; font-size: .72rem; }
	.fto-strip__label { font-size: .7rem; letter-spacing: .06em; }
	.fto-app__lead-row { flex-direction: column; }
	.fto-app__lead-row .fto-btn { width: 100%; }
	.fto-sheet { max-height: 86%; }
}

@media (prefers-reduced-motion: reduce) {
	.fto-app__placeholder-icon, .fto-scan__laser, .fto-scan__grid { animation: none; }
	.fto-scan__bar i { transition: none; }
}
