/*
  InmoTeam AI: the brand on top of the taste kit.

  Load order (app/layout.tsx): system.css, ui/cards.css, motion/motion.css, layout/layout.css,
  then this file last. Same specificity as the kit, so this file wins by order.
  Where the kit uses a stronger selector (html[data-radius], html:not([data-motion=off]) .btn...),
  the rule here repeats that selector on purpose.

  1. Raw palette        --amarillo, --negro, --hueso, --piedra, --gris, --blanco, --gris-claro,
                        --carbon, --carbon-borde, --ia-fondo, --ia-borde, --en-linea
  2. Kit tokens         --p-*, --ground-*, --font-*, --display-*, --t-*, --r-*, --btn-h, --line
  3. Base overrides     weights (400, 600, 800 only), headings, focus, buttons, fields, nav
  4. Brand components   .etiqueta .marca .resalte .chat .msg .sistema .canal .en-linea .ficha
                        .campos .etapa .cifra .pasos .control (slider) .empleado .ficha-foto .mano
  5. Reduced motion     every brand animation stops, ::before and ::after included

  Reference: ../docs/marca/index.html (brand page) and ../docs/referencia/landing-v1.html (mockup).
  Conventions for the sections: components/README.md.
*/

/* ------------------------------------------------------------------ 1. raw palette */
:root {
    --amarillo: #ffd23f;
    --negro: #121212;
    --hueso: #f7f5ef;
    --piedra: #e6e2d8;
    --gris: #67645c;
    /* gris at reading size (leads, card text, notes): 7,49:1 on hueso, 8,17:1 on blanco; --gris stays
       for labels and metadata at 14px and under (DESIGN.md, Gris Texto) */
    --gris-texto: #524f48;
    --blanco: #ffffff;
    --gris-claro: #c4c0b6;
    --carbon: #1f1e1b;
    --carbon-borde: #2e2d29;
    --ia-fondo: #fff6d1;
    --ia-borde: #f3e3a0;
    --en-linea: #2bb673;

    /* product UI floats (DESIGN.md, Elevation): only the chat, the app frame and the CRM card */
    --sombra-panel: 0 30px 60px -30px rgba(18, 18, 18, 0.25);
    --sombra-ficha: 0 30px 60px -24px rgba(18, 18, 18, 0.45);

    /* brand radii the kit has no token for */
    --r-tile: 18px;
    --r-bubble: 20px;
    --r-pill: 999px;

    color-scheme: light;
}

/* ------------------------------------------------------------------ 2. kit tokens */
:root {
    /* page ground hueso, cards and panels blanco, ink negro, muted gris texto */
    --p-bg: #f7f5ef;
    --p-surface: #ffffff;
    --p-ink: #121212;
    --p-muted: #524f48;
    --p-accent: #ffd23f;
    --p-accent-ink: #121212;
    --p-action: #121212;
    --p-action-ink: #ffd23f;
    /* the black band: carbón cards, hueso text, gris claro muted, yellow action with black text */
    --p-inv-bg: #121212;
    --p-inv-surface: #1f1e1b;
    --p-inv-ink: #f7f5ef;
    --p-inv-muted: #c4c0b6;
    --p-inv-accent: #ffd23f;
    --p-inv-accent-ink: #121212;
    --p-inv-action: #ffd23f;
    --p-inv-action-ink: #121212;
    /* the kit's lit ground (hero frame, .frame--cta): flat piedra, no lit grounds on this page */
    --ground-bg: #e6e2d8;
    --ground-surface: #ffffff;
    --ground-ink: #121212;
    --ground-muted: #524f48;
    --ground-accent: #ffd23f;

    /* one family: --font-bricolage is set by next/font on <html> */
    --font-display:
        var(--font-bricolage, 'Bricolage Grotesque'), ui-sans-serif, system-ui, -apple-system,
        'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-text: var(--font-display);
    --display-weight: 800;
    --display-tracking: -0.035em;
    --display-tracking-xl: -0.035em;

    /* type (DESIGN.md frontmatter) */
    --t-body: 18px;
    --t-lead: clamp(1.08rem, 1.6vw, 1.25rem);
    --t-card: 1.35rem;
    --t-h3: 1.35rem;
    --t-h2: clamp(2.05rem, 3.6vw, 3rem);
    --t-h1: clamp(2.5rem, 5.4vw, 4.6rem);
    /* under 40px, as the kit's own (38px): a figure is not a heading */
    --t-stat: clamp(2rem, 4vw, 2.4rem);

    /* buttons 52 high (the phone bar keeps the kit's 48) */
    --btn-h: 52px;
}

/* radii: cards and frames 32, panels 22, fields 14, buttons 16 (the kit sets these on html[data-radius]) */
html[data-radius] {
    --r-sm: 14px;
    --r-md: 22px;
    --r-lg: 32px;
    --r-btn: 16px;
}

/* hairlines: piedra on light grounds, carbón borde on black */
:root,
.ground-base,
.ground-surface {
    --line: #e6e2d8;
    --action-hover: #000000;
}
.ground-inverse {
    --line: #2e2d29;
    --action-hover: color-mix(in oklab, #ffd23f 84%, #121212);
}
/* the yellow band (ahorro): black on yellow, white cards, black primary with yellow text */
.ground-brand {
    --surface: #ffffff;
    --card: #ffffff;
    --accent: #121212;
    --accent-ink: #ffd23f;
    --action-hover: #000000;
}

/* ------------------------------------------------------------------ 3. base overrides */
/* A real phone (as landing-dentaflow's globals.css). The page never pans sideways: clip on html as
   well as the kit's on body (Safari reads it from html; clip, unlike hidden, keeps the fixed header
   and sticky parts working), and no sideways rubber band. A tap on a control neither waits for a
   double tap nor flashes grey (the kit's press state shows it). In landscape, with viewport-fit=cover,
   the gutters clear the notch or the Dynamic Island, by the larger inset on both sides so the content
   edges stay equal */
html {
    overflow-x: clip;
    overscroll-behavior-x: none;
}
:is(a, button, label, summary, select, [role='button'], [role='tab']) {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
@media (max-width: 639px) {
    :root {
        --gut: max(24px, env(safe-area-inset-left), env(safe-area-inset-right));
    }
}
@media (min-width: 640px) and (max-width: 1023px) {
    :root {
        --gut: max(48px, env(safe-area-inset-left), env(safe-area-inset-right));
    }
}

/* No 700: a variable font would draw a real 700; the brand only knows 400, 600 and 800 */
b,
strong {
    font-weight: 800;
}

h1,
.t-h1 {
    line-height: 0.98;
}
h2,
.t-h2 {
    line-height: 1.02;
}
h3,
.t-h3 {
    line-height: 1.15;
    letter-spacing: -0.02em;
}
.hero h1 {
    line-height: 0.98;
}
/* card and tile titles are brand titles (800, display), not the kit's 500 text face */
.card > h3,
.card__title,
.card--plan h3,
.tile__head > :is(h3, h4) {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: var(--t-h3);
    line-height: 1.15;
    letter-spacing: -0.02em;
}

/* cards: flat at rest with a 1px piedra line (carbón borde on black); radius 32 comes from --r-lg.
   Only product UI casts a shadow (DESIGN.md, The Product Floats Rule); the hover lift is motion.css */
.card {
    --c-border: var(--line);
    box-shadow: none;
}

/* the lead under an h2: gris, 58 characters (DESIGN.md, Lead) */
.section-head p {
    color: var(--muted);
    max-width: 58ch;
}

/* the kit's 500s, set to the brand's 600 */
.t-label,
.link,
.rows__name,
.hero-facts dd,
.tab,
.footer :is(h3, h4):not(.closing__cta *) {
    font-weight: 600;
}

/* focus: 3px in the action colour (black on light, yellow on black, black on yellow), 3px off */
:focus-visible {
    outline: 3px solid var(--action);
    outline-offset: 3px;
}

/* buttons: 52 high, 17px at 800, radius 16 (--r-btn), arrow 20px (.btn--xl keeps the kit's size) */
.btn {
    gap: 10px;
    font-weight: 800;
}
.btn:not(.btn--xl) {
    font-size: 17px;
}
.btn > svg:not(.m-arrow) {
    width: 20px;
    height: 20px;
    flex: none;
}
.btn > .m-arrow {
    width: 20px;
    height: 20px;
    margin-right: 0;
    stroke-width: 1.2;
}
/* hover: the black darkens to #000 (the kit steps toward the ground); the 1px lift is motion.css */
.btn--primary:hover,
.ground-brand .btn--primary:hover,
html:not([data-motion='off']) .btn--primary:hover {
    background: var(--action-hover);
}
/* the outline button: a 2px inset line in the ink */
.btn--secondary {
    border-color: transparent;
    box-shadow: inset 0 0 0 2px currentColor;
}
@media (max-width: 639px) {
    .btn-row > .btn--secondary {
        box-shadow: none;
    }
}

/* fields: white, 2px piedra, radius 14, 17px text; the label 15px at 800 above */
.field {
    font-size: 15px;
    font-weight: 800;
}
.field :is(input, select, textarea) {
    padding-inline: 16px;
    border: 2px solid var(--piedra);
    background: var(--blanco);
    color: var(--negro);
    font-size: 17px;
}

/* header: opaque hueso (kit rule, no blur), logo 34 tall, words 15px at 600 */
.nav__logo img {
    height: 34px;
    width: auto;
}
.nav__link {
    font-weight: 600;
}
.nav__actions .btn {
    height: 44px;
    padding-inline: 18px;
    font-size: 16px;
}
/* 1024-1079: the centred words leave the logo less than its 182px; it steps down to 28 tall there
   instead of being squeezed by its grid column */
@media (min-width: 1024px) and (max-width: 1079px) {
    .nav__logo img {
        height: 28px;
    }
}

/* the phone bar: two 165 x 48 buttons, so a tighter label */
.actionbar .btn {
    padding-inline: 12px;
    font-size: 16px;
}
/* «Llamar ahora»: the yellow button beside the black one (DESIGN.md, Buttons: yellow «cuando el negro
   ya se usa al lado»), as it is on the black band of #pruebalo; an outline here was a third button
   style on the page (consistency.mjs button-styles, same-action). The focus ring stays black. */
.actionbar .actionbar__call {
    background: var(--amarillo);
    border-color: transparent;
    color: var(--negro);
}
.actionbar .actionbar__call:hover,
html:not([data-motion='off']) .actionbar .actionbar__call:hover {
    background: color-mix(in oklab, var(--amarillo) 84%, var(--negro));
}
.actionbar .actionbar__call:focus-visible {
    outline-color: var(--negro);
}

/* ------------------------------------------------------------------ 4. brand components */
/* .etiqueta: the yellow label pill (only the hero keeps one, LANDING-PLAN) */
.etiqueta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    align-self: flex-start;
    padding: 7px 14px;
    border-radius: var(--r-pill);
    background: var(--amarillo);
    color: var(--negro);
    font-size: 15px;
    font-weight: 800;
    line-height: 1.2;
}
.ground-brand .etiqueta {
    background: var(--negro);
    color: var(--amarillo);
}
@media (max-width: 380px) {
    .hero .etiqueta {
        font-size: 13px;
        padding-inline: 12px;
    }
}

/* .marca: the one yellow highlight of the page (the h1's "equipo IA."); .resalte: yellow words on black */
.marca {
    padding: 0 0.14em;
    border-radius: 0.16em;
    background: var(--amarillo);
    color: var(--negro);
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
}
.ground-inverse .resalte {
    color: var(--amarillo);
}

/* .chat: the product panel (white, 32, shadow) with its head and messages */
.chat {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--piedra);
    border-radius: var(--r-lg);
    background: var(--blanco);
    color: var(--negro);
    box-shadow: var(--sombra-panel);
}
.chat-cab {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--piedra);
}
.chat-cab .avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 40px;
    height: 40px;
    border-radius: var(--r-pill);
    background: var(--piedra);
    font-size: 17px;
    font-weight: 800;
}
.chat-cab .quien {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.2;
}
.chat-cab .quien b {
    font-size: 16px;
}
.chat-cab .quien span {
    font-size: 13px;
    color: var(--gris);
}
.chat-cab .canal {
    margin-left: auto;
}
.mensajes {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 20px;
}
.msg {
    max-width: 86%;
    padding: 11px 15px;
    font-size: 15.5px;
    line-height: 1.42;
}
.msg-cliente {
    align-self: flex-start;
    border: 1px solid var(--piedra);
    border-radius: var(--r-bubble) var(--r-bubble) var(--r-bubble) 6px;
    background: var(--hueso);
}
.msg-agente {
    align-self: flex-end;
    border-radius: var(--r-bubble) var(--r-bubble) 6px var(--r-bubble);
    background: var(--amarillo);
    color: var(--negro);
}
.msg-meta {
    margin-top: -4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--gris);
}
.msg-meta.agente {
    align-self: flex-end;
}
/* a message coming in: up 6px in .35s (add .entra when it is shown) */
.msg.entra {
    animation: entra 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes entra {
    from {
        transform: translateY(6px);
        opacity: 0.3;
    }
    to {
        transform: none;
        opacity: 1;
    }
}
/* .sistema: the system note, a centred pill */
.sistema {
    display: inline-flex;
    align-items: center;
    align-self: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--piedra);
    border-radius: var(--r-pill);
    background: var(--hueso);
    color: var(--gris);
    font-size: 12.5px;
    font-weight: 800;
    line-height: 1.2;
    text-align: center;
}
.sistema .icon {
    --icon-size: 14px;
    color: var(--negro);
    --cut: var(--hueso);
}

/* .canal: the channel chip (WhatsApp, Idealista, Llamada...) */
.canal {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px 5px 8px;
    border: 1px solid var(--piedra);
    border-radius: var(--r-pill);
    background: var(--hueso);
    color: var(--negro);
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
}
.canal .icon {
    --icon-size: 15px;
    color: var(--negro);
    --cut: var(--hueso);
}

/* .en-linea: the green dot that beats beside "InmoTeam AI · 23:44" (its only use) */
.en-linea {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--gris);
    font-size: 12.5px;
    font-weight: 800;
}
.en-linea::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: var(--r-pill);
    background: var(--en-linea);
    animation: pulso 2s infinite;
}
@keyframes pulso {
    0% {
        box-shadow: 0 0 0 0 rgba(43, 182, 115, 0.45);
    }
    70% {
        box-shadow: 0 0 0 8px rgba(43, 182, 115, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(43, 182, 115, 0);
    }
}

/* .ficha: the CRM card (black, 22) with .campos rows, .etapa pill and its foot */
.ficha {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
    padding: 20px;
    border-radius: var(--r-md);
    background: var(--negro);
    color: var(--hueso);
}
.ficha-cab {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.ficha-cab b {
    font-size: 17px;
    letter-spacing: -0.01em;
}
.ficha-cab span {
    color: var(--gris-claro);
    font-size: 12px;
    font-weight: 800;
}
.campos {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 9px 16px;
    margin: 0;
    font-size: 14.5px;
}
.campos dt {
    color: var(--gris-claro);
}
.campos dd {
    min-width: 0;
    margin: 0;
    border-radius: 6px;
    font-weight: 600;
    transition: background-color 0.4s ease;
}
/* a field the agent has just filled in */
.campos dd.nuevo {
    background: rgba(255, 210, 63, 0.18);
    box-shadow: 0 0 0 4px rgba(255, 210, 63, 0.18);
}
.etapa {
    display: inline-block;
    padding: 3px 9px;
    border-radius: var(--r-pill);
    background: var(--amarillo);
    color: var(--negro);
    font-size: 13px;
    font-weight: 800;
}
.etapa.gris {
    background: var(--carbon-borde);
    color: var(--hueso);
}
.ficha-pie {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--carbon-borde);
    color: var(--gris-claro);
    font-size: 12.5px;
    font-weight: 600;
}
.ficha-pie img {
    flex: none;
    width: 20px;
    height: 20px;
}

/* .cifra: a figure tile (white, 18); .destacada: the yellow one */
.cifra {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    padding: 16px 18px;
    border: 1px solid var(--piedra);
    border-radius: var(--r-tile);
    background: var(--blanco);
    color: var(--negro);
}
.cifra b {
    font-size: var(--t-stat);
    line-height: 1.05;
    letter-spacing: -0.04em;
    font-variant-numeric: tabular-nums;
}
.cifra span {
    color: var(--gris);
    font-size: 14px;
    line-height: 1.35;
}
.cifra.destacada {
    border-color: var(--amarillo);
    background: var(--amarillo);
}
.cifra.destacada span {
    color: var(--negro);
}

/* .pasos: the step buttons of "Cómo trabaja" (aria-pressed marks the open one; .auto is its timer bar) */
.pasos button {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    width: 100%;
    overflow: hidden;
    padding: 14px 16px;
    border: 2px solid var(--piedra);
    border-radius: var(--r-tile);
    background: var(--blanco);
    color: var(--negro);
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.pasos button .n {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--r-pill);
    background: var(--piedra);
    font-size: 14px;
    font-weight: 800;
}
.pasos button b {
    font-size: 17px;
    letter-spacing: -0.01em;
}
.pasos button[aria-pressed='true'] {
    border-color: var(--negro);
    background: var(--negro);
    color: var(--hueso);
}
.pasos button[aria-pressed='true'] .n {
    background: var(--amarillo);
    color: var(--negro);
}
/* the timer bar fills by transform (the mockup animated width; the kit never animates layout):
   set animation-duration inline to the step's length */
.pasos button .auto {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 3px;
    background: var(--amarillo);
    transform: scaleX(0);
    transform-origin: left;
    animation: llena linear forwards;
}
@keyframes llena {
    to {
        transform: scaleX(1);
    }
}

/* .control: a slider with its label and value (components/ui/RangeField.tsx) */
.control {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.control-fila {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}
.control label {
    font-size: 16px;
    font-weight: 600;
}
.control output {
    font-size: 20px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.control-nota {
    margin-top: -4px;
    color: var(--muted);
    font-size: 14px;
}
/* the slider: an 8px track, black up to the value (--p, a percentage set inline) and piedra after,
   a 26px yellow thumb with a 3px black ring. --range-fill and --range-track recolour it on a dark ground */
input[type='range'] {
    --range-fill: var(--negro);
    --range-track: var(--piedra);
    width: 100%;
    height: 28px;
    margin: 0;
    background: transparent;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}
input[type='range']::-webkit-slider-runnable-track {
    height: 8px;
    border-radius: var(--r-pill);
    background: linear-gradient(
        to right,
        var(--range-fill) var(--p, 50%),
        var(--range-track) var(--p, 50%)
    );
}
input[type='range']::-moz-range-track {
    height: 8px;
    border-radius: var(--r-pill);
    background: var(--range-track);
}
input[type='range']::-moz-range-progress {
    height: 8px;
    border-radius: var(--r-pill);
    background: var(--range-fill);
}
input[type='range']::-webkit-slider-thumb {
    width: 26px;
    height: 26px;
    margin-top: -9px;
    border: 3px solid var(--negro);
    border-radius: var(--r-pill);
    background: var(--amarillo);
    -webkit-appearance: none;
}
input[type='range']::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border: 3px solid var(--negro);
    border-radius: var(--r-pill);
    background: var(--amarillo);
}

/* .empleado: the employee card (white, 2px black, 32) with .ficha-foto, .nombre, .ficha-rol, .ficha-que */
.empleado {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-width: 0;
    padding: 16px clamp(12px, 2.4vw, 22px) 22px;
    border: 2px solid var(--negro);
    border-radius: var(--r-lg);
    background: var(--blanco);
    color: var(--negro);
    text-align: center;
}
.empleado .nombre {
    margin-top: 8px;
    padding: 3px 10px;
    border-radius: var(--r-pill);
    background: var(--negro);
    color: var(--amarillo);
    font-size: 13px;
    font-weight: 800;
}
/* the agent's photo on its yellow circle (94% of its width, its foot on the photo's foot): the bust
   ends on the circle's arc (public/agents/*, 480 x 491) and the head rises out of it */
.ficha-foto {
    position: relative;
    display: block;
    width: min(190px, 92%);
    margin-bottom: 4px;
    line-height: 0;
}
.ficha-foto::before {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 0;
    width: 94%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: var(--amarillo);
    transform: translateX(-50%);
}
.ficha-foto > picture {
    display: block;
}
.ficha-foto img {
    position: relative;
    display: block;
    width: 100%;
    height: auto;
}
.ficha-rol {
    font-size: clamp(16px, 2.2vw, 20px);
    font-weight: 800;
    letter-spacing: -0.01em;
    line-height: 1.15;
}
.ficha-que {
    color: var(--gris);
    font-size: clamp(13.5px, 1.7vw, 15px);
    line-height: 1.35;
}

/* the waving hand of "¡Hola! Soy Álvaro 👋": three waves, 2.4s each */
.mano {
    display: inline-block;
    transform-origin: 70% 75%;
    animation: saluda 2.4s ease-in-out 0.5s 3;
}
@keyframes saluda {
    0%,
    60%,
    100% {
        transform: rotate(0);
    }
    10% {
        transform: rotate(16deg);
    }
    20% {
        transform: rotate(-8deg);
    }
    30% {
        transform: rotate(16deg);
    }
    40% {
        transform: rotate(-4deg);
    }
    50% {
        transform: rotate(10deg);
    }
}

/* .icon: an icon from /brand/icons.svg (components/ui/Icon.tsx). --icon-size sets it; --cut is the
   colour of its cut-outs, the ground behind it (the ground by default) */
.icon {
    flex: none;
    width: var(--icon-size, 20px);
    height: var(--icon-size, 20px);
    --cut: var(--bg);
}

/* ------------------------------------------------------------------ 5. reduced motion */
/* system.css shortens every animation to its end; these stop outright, ::before and ::after included
   (the mockup's rule missed them and the online dot kept beating) */
@media (prefers-reduced-motion: reduce) {
    .msg.entra,
    .mano,
    .pasos button .auto,
    .en-linea::before,
    .en-linea::after {
        animation: none !important;
    }
    .campos dd {
        transition: none;
    }
}
