Files
whatsapp-api-mockup/css/iphone.css
T
2026-09-27 19:17:33 -06:00

245 lines
7.1 KiB
CSS
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/* =====================================================================
WhatsApp Cloud API Mockup — css/iphone.css (Módulo A · shell)
Columna de vista previa (#panel-movil, #barra-movil) y marco iPhone
393×852 (radio 55, negro) con Dynamic Island, status bar de 54 pt e
indicador home. Escalado 100 % CSS (transform + var --wam-escala)
para caber siempre en la pantalla. Geometría según docs/research-ui.md §7.
===================================================================== */
/* --- Escala del teléfono ----------------------------------------------
Fallback por pasos (media queries) y ajuste exacto con aritmética
tipada de CSS (@supports), que calcula escala = espacio disponible /
tamaño natural. El escenario reserva el tamaño YA escalado para que
el layout no deje huecos ni recortes. */
:root { --wam-escala: 1; }
@media (max-height: 1030px) { :root { --wam-escala: .9; } }
@media (max-height: 940px) { :root { --wam-escala: .82; } }
@media (max-height: 860px) { :root { --wam-escala: .74; } }
@media (max-height: 780px) { :root { --wam-escala: .66; } }
@media (max-height: 700px) { :root { --wam-escala: .58; } }
@media (max-height: 620px) { :root { --wam-escala: .5; } }
@supports (scale: calc(1vh / 1px)) {
:root {
/* 150 px = toolbar + barra-movil + aire; 352 px = editor mínimo + aire.
px/px → número (requisito de scale()); min/max solo comparan números. */
--wam-escala: max(.3, min(
1,
(100vh - 150px) / 852px,
(100vw - 352px) / 393px
));
}
body.presentacion {
/* sin editor cabe más teléfono (el ahorro es horizontal; el vertical igual) */
--wam-escala: max(.3, min(
1,
(100vh - 150px) / 852px,
(100vw - 64px) / 393px
));
}
}
/* --- Columna de vista previa (#panel-movil) ---------------------------- */
#panel-movil {
min-width: 0;
min-height: 0;
display: flex;
flex-direction: column;
align-items: center;
padding: 14px 16px 18px;
overflow: auto;
background:
radial-gradient(1200px 500px at 50% -10%, rgba(0, 168, 132, .08), transparent 60%),
var(--wam-fondo);
}
/* Barra sobre el teléfono */
#barra-movil {
flex: none;
width: 100%;
max-width: 560px;
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
margin-bottom: 14px;
}
#barra-movil .barra-titulo {
font-size: 12px;
font-weight: 700;
letter-spacing: .12em;
text-transform: uppercase;
color: var(--wam-texto-suave);
}
#btn-reproducir {
display: inline-flex;
align-items: center;
gap: 8px;
padding: 9px 16px;
border: 0;
border-radius: 999px;
background: var(--wam-acento);
color: #fff;
font-size: 13px;
font-weight: 700;
cursor: pointer;
box-shadow: 0 4px 14px rgba(0, 168, 132, .35);
transition: background-color .15s ease, transform .05s ease;
}
#btn-reproducir:hover { background: var(--wam-acento-hover); }
#btn-reproducir:active { transform: translateY(1px); }
/* Escenario: reserva el tamaño ya escalado */
.iphone-escena {
flex: none;
margin: auto; /* centra con espacio sobrante; sin clipping si no cabe */
width: calc(393px * var(--wam-escala));
height: calc(852px * var(--wam-escala));
}
/* --- Marco iPhone: 393×852 pt, radio 55, negro (research-ui §7) -------- */
.iphone {
position: relative;
width: 393px;
height: 852px;
border-radius: 55px;
background: #000;
overflow: hidden;
transform: scale(var(--wam-escala));
transform-origin: top left;
box-shadow:
0 0 0 2px #3d4348, /* aro de titanio */
0 0 0 3.5px #1b1f22,
0 30px 60px rgba(4, 12, 10, .45);
}
/* Pantalla: llena el marco; el look del chat lo gobierna .wa (módulo B) */
.pantalla {
position: absolute;
inset: 0;
display: flex;
flex-direction: column;
overflow: hidden;
border-radius: 47px;
background: #efeae2; /* valor de arranque (claro); .wa / .wa.oscuro mandan */
padding-top: 54px; /* status bar de 54 pt: el header arranca debajo */
}
/* Dynamic Island: 126×37, top 11 */
.island {
position: absolute;
top: 11px;
left: 50%;
transform: translateX(-50%);
width: 126px;
height: 37px;
border-radius: 20px;
background: #000;
z-index: 40;
}
.island::after { /* lente de la cámara frontal */
content: "";
position: absolute;
top: 50%;
right: 11px;
transform: translateY(-50%);
width: 9px;
height: 9px;
border-radius: 50%;
background: radial-gradient(circle at 35% 32%, #223244 0 22%, #05080c 62%);
}
/* Status bar: 54 pt; hora "9:41" + señal / wifi / batería */
.statusbar {
position: absolute;
top: 0;
left: 0;
right: 0;
height: 54px;
display: flex;
align-items: center;
justify-content: space-between;
padding: 18px 30px 0 34px;
color: #111b21; /* en claro, status bar oscura (research-ui §7) */
font-size: 15px;
font-weight: 600;
letter-spacing: .02em;
z-index: 30;
pointer-events: none;
}
.sb-hora { min-width: 44px; font-variant-numeric: tabular-nums; }
.statusbar .sb-iconos { display: flex; align-items: center; gap: 7px; }
#pantalla.oscuro .statusbar { color: #fff; }
/* Indicador home: 139×5, bottom 8 */
.home-indicator {
position: absolute;
bottom: 8px;
left: 50%;
transform: translateX(-50%);
width: 139px;
height: 5px;
border-radius: 3px;
background: #fff; /* en oscuro (research-ui §7) */
z-index: 45;
pointer-events: none;
}
#pantalla:not(.oscuro) .home-indicator { background: #0b141a; } /* en claro, oscuro */
/* --- Colocación del chat (estructura A; la estética es css/whatsapp.css B) */
#chat-header { flex: none; }
.header-linea { display: flex; align-items: center; gap: 4px; min-width: 0; }
#chat-verificado { display: inline-flex; flex: none; }
#chat-cuerpo {
flex: 1 1 auto;
min-height: 0;
overflow-y: auto;
overflow-x: hidden;
list-style: none;
padding: 8px 0 14px;
scroll-behavior: smooth;
overscroll-behavior: contain;
}
#chat-escribiendo { flex: none; }
#composer { flex: none; }
/* Composer: solo valores de arranque con var(--wa-*) de B (con fallback);
whatsapp.css (cargado después) prevalece en caso de empate. */
#composer .attach,
#composer .enviar {
display: inline-flex;
padding: 2px;
border: 0;
background: none;
cursor: pointer;
}
#composer .attach { color: var(--wa-text-meta, #667781); }
#composer .enviar { color: var(--wa-accent, #00a884); }
#composer .field svg { flex: none; opacity: .55; color: var(--wa-text-meta, #667781); }
#composer-input {
flex: 1 1 auto;
min-width: 0;
padding: 0;
border: 0;
outline: none;
background: transparent;
color: inherit;
font-size: 16px;
}
#composer-input::placeholder { color: var(--wa-text-meta, #667781); }
/* Color de arranque de los iconos del header (B puede reestilarlos) */
#chat-header .back-chevron { color: var(--wa-accent, #00a884); }
#chat-header .icon-video,
#chat-header .icon-call { color: var(--wa-chrome-text, #111b21); }
/* --- Modo presentación: el iPhone se centra y respira más --------------- */
body.presentacion #panel-movil { padding: 14px 20px 22px; }
/* --- Accesibilidad: menos movimiento ------------------------------------- */
@media (prefers-reduced-motion: reduce) {
#btn-reproducir { transition: none; }
}