/* ==========================================================================
   VelizPetrola — estilos del sitio (sin frameworks)
   Paleta del estudio: azul #003c64, grafito #323232, arena #e3dfd6.
   ========================================================================== */

:root {
    --ink: #323232;
    --ink-2: #3c3c3c;
    --ink-3: #4a4a4a;
    --text: #323232;
    --text-muted: #6b6b6b;
    --text-inverse: #ffffff;
    --text-inverse-muted: #e3dfd6;
    --bg: #ffffff;
    --bg-alt: #f6f4f0;
    --sand: #e3dfd6;
    --line: #e3dfd6;
    --line-dark: #4a4a4a;

    --accent: #003c64;
    --accent-2: #e3dfd6;
    --accent-ink: #ffffff;
    --accent-soft: #e8eef3;

    --bad: #b42318;
    --bad-soft: #fef3f2;
    --good: #2f6b3a;
    --good-soft: #eef6ef;

    --radius: 4px;
    --radius-sm: 3px;
    --shadow: 0 1px 2px rgb(0 0 0 / .05), 0 8px 24px rgb(0 0 0 / .06);
    --shadow-lg: 0 20px 50px rgb(0 0 0 / .25);

    --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --serif: "EB Garamond", Garamond, "Times New Roman", serif;
    --mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
}

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

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; overflow-wrap: break-word; }
h1, h2 { font-family: var(--serif); font-weight: 400; }
h1 { font-size: clamp(2.2rem, 5vw, 4.1rem); line-height: 1.05; }
h2 { font-size: clamp(1.9rem, 3.4vw, 2.7rem); }
h2 em { font-style: italic; }
h3 { font-size: 1.15rem; font-weight: 600; }
p { margin: 0 0 1em; }
a { color: var(--accent); }
code { font-family: var(--mono); font-size: .9em; }
img { max-width: 100%; height: auto; display: block; }

.container { width: min(1160px, 100% - 2.5rem); margin-inline: auto; }
.muted { color: var(--text-muted); }
.small { font-size: .875rem; }
.eyebrow {
    font-size: .95rem;
    font-weight: 600;
    letter-spacing: .02em;
    text-transform: uppercase;
    margin-bottom: .75rem;
}
.tag {
    display: inline-block;
    font-size: .72rem;
    font-weight: 600;
    padding: .15rem .55rem;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    margin-left: .4rem;
}
.badge {
    display: inline-grid;
    place-items: center;
    min-width: 1.35rem;
    height: 1.35rem;
    padding: 0 .35rem;
    border-radius: 999px;
    background: var(--accent);
    color: var(--accent-ink);
    font-size: .72rem;
    font-weight: 700;
    line-height: 1;
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .7rem 1.2rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}
.btn:disabled { opacity: .6; cursor: wait; }
.btn--primary {
    background: var(--accent);
    color: var(--accent-ink);
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .02em;
    padding: .8rem 1.4rem;
    border-radius: 0;
}
.btn--primary:hover { background: #00507f; }
.btn--ghost { background: transparent; border-color: currentColor; color: inherit; }
.btn--danger { background: transparent; border-color: var(--bad); color: var(--bad); }
.btn--danger:hover { background: var(--bad); color: #fff; }
.icon-btn {
    flex: none;
    display: inline-grid;
    place-items: center;
    width: 2.1rem;
    height: 2.1rem;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: background .15s ease, color .15s ease, opacity .15s ease;
}
.icon-btn--danger:hover { background: var(--bad-soft); color: var(--bad); }
.btn--sm { padding: .4rem .9rem; font-size: .875rem; }
.btn--lg { padding: .9rem 1.6rem; font-size: 1.05rem; }
.btn--block { width: 100%; }

/* ---- Navegación (solo admin) ------------------------------------------------- */

.nav {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--ink);
    color: var(--text-inverse);
}
.nav__inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 64px; }
.brand {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    font-family: var(--serif);
    font-size: 1.35rem;
    color: inherit;
    text-decoration: none;
}
.nav__links { display: flex; align-items: center; gap: 1.4rem; }
.nav__links a:not(.btn) { color: var(--text-inverse-muted); text-decoration: none; font-weight: 500; }
.nav__links a:not(.btn):hover { color: var(--text-inverse); }
.nav__links form { margin: 0; }

/* ---- Hero ----------------------------------------------------------------- */

.hero {
    position: relative;
    min-height: clamp(460px, 68vh, 720px);
    display: flex;
    align-items: center;
    padding: 4rem 0;
    background: #f2f2f2 url("../img/hero.jpg") center / cover no-repeat;
}
.hero__grid {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 2rem;
}
.hero__copy h1 { margin-bottom: 2.5rem; }
.hero__lead { font-size: 1.25rem; margin: 0; }
.hero__actions { display: flex; flex-direction: column; gap: .6rem; margin-top: 6rem; }
@media (max-width: 760px) {
    .hero { align-items: flex-start; background-position: 70% center; }
    .hero__grid { grid-template-columns: 1fr; }
    .hero__copy { background: rgb(255 255 255 / .75); padding: 1.25rem; }
    .hero__copy h1 { margin-bottom: 1.25rem; }
    .hero__actions { flex-direction: row; flex-wrap: wrap; margin-top: 0; }
}

/* ---- Secciones ------------------------------------------------------------ */

.section { padding: clamp(3.5rem, 8vw, 6.5rem) 0; }
.section--dark { background: var(--ink); color: var(--text-inverse); }
.section--sand { background: var(--sand); }

.card {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.6rem;
}

/* ¿Tu prepaga te negó un tratamiento? */
.split { display: grid; grid-template-columns: 1.4fr 1fr; gap: 3rem; align-items: center; }
.split__copy { text-align: center; max-width: 34rem; margin-inline: auto; }
.split__copy p { margin-bottom: 3rem; }
.split__img { width: 100%; max-height: 640px; object-fit: cover; }
@media (max-width: 760px) {
    .split { grid-template-columns: 1fr; }
    .split__img { max-height: 420px; }
}

/* En qué nos enfocamos */
.focus { display: grid; grid-template-columns: 1fr 2fr; gap: 2.5rem; align-items: center; }
.focus__title { color: var(--sand); }
.focus__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; align-items: start; }
.focus__grid > * { min-width: 0; }
.focus-card { padding: 1.1rem 1.25rem 1.4rem; font-size: .95rem; }
.focus-card h3 { font-family: var(--serif); font-weight: 400; font-size: 1.7rem; margin-bottom: .6rem; letter-spacing: -.02em; }
.focus-card p:last-child { margin-bottom: 0; }
.focus-card--navy { background: var(--accent); color: #fff; }
.focus-card--sand { background: var(--sand); color: var(--ink); }
.focus-card--light { background: #fff; color: var(--ink); }
.focus__img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
@media (max-width: 900px) { .focus { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .focus__grid { grid-template-columns: 1fr; } }

/* Nuestros servicios principales */
.banner { width: 100%; aspect-ratio: 16 / 6; object-fit: cover; margin-bottom: 2.5rem; }
.services { display: grid; grid-template-columns: 1.1fr 1fr 1fr; gap: 2rem; align-items: start; }
.services__head { font-size: .95rem; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; margin-bottom: 1rem; }
.services__list { margin: 0; padding-left: 1.2rem; line-height: 1.75; }
.services__img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
@media (max-width: 900px) { .services { grid-template-columns: 1fr 1fr; } .services h2 { grid-column: 1 / -1; } }
@media (max-width: 560px) { .services { grid-template-columns: 1fr; } }

/* Un poco más de nosotros */
.about h2 { font-family: var(--font); font-size: clamp(1.8rem, 3.2vw, 2.6rem); margin-bottom: 1.5rem; }
.about p { max-width: 100ch; }

/* ---- Formularios ------------------------------------------------------------ */

.form { display: grid; gap: 1rem; }
.form label { display: grid; gap: .35rem; font-size: .9rem; font-weight: 500; }
.form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 560px) { .form__row { grid-template-columns: 1fr; } }
input, select, textarea {
    width: 100%;
    font: inherit;
    font-size: .95rem;
    color: var(--text);
    padding: .65rem .8rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #fff;
    transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgb(0 60 100 / .18);
}
textarea { resize: vertical; }
.input-validation-error { border-color: var(--bad); }
.field-error { color: var(--bad); font-size: .8rem; font-weight: 500; }
.field-error:empty { display: none; }
.form__note { font-size: .8rem; color: var(--text-muted); text-align: center; margin: 0; }
.hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.alert { background: var(--bad-soft); color: var(--bad); padding: .7rem 1rem; border-radius: var(--radius-sm); margin: 0; }

.thanks { text-align: center; padding: 3rem 2rem; }
.thanks__icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--good-soft);
    color: var(--good);
    font-size: 2rem;
    font-weight: 800;
}

/* ---- Footer / contacto -------------------------------------------------------- */

.footer { background: var(--ink); color: var(--sand); padding: 3.5rem 0 6rem; }
.footer a { color: inherit; text-decoration: none; }
.footer a:hover { text-decoration: underline; }
.footer .eyebrow { color: #fff; margin-bottom: 1.5rem; }
.footer__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; }
@media (max-width: 640px) { .footer__grid { grid-template-columns: 1fr; } }
.footer h2 { font-size: clamp(1.8rem, 3vw, 2.4rem); margin-bottom: .75rem; }
.footer__list { list-style: none; margin: 0; padding: 0; display: grid; gap: .9rem; font-size: 1.05rem; line-height: 1.45; }
.footer__bottom { display: flex; flex-wrap: wrap; gap: 1.25rem; margin-top: 3rem; padding-top: 1.25rem; border-top: 1px solid var(--line-dark); font-size: .85rem; opacity: .8; }

.prose { max-width: 70ch; }

/* ---- Chat widget -------------------------------------------------------------- */

.chat { position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 100; }
.chat__fab {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    padding: .85rem 1.2rem;
    border: none;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 10px 30px rgb(0 60 100 / .35);
    transition: transform .15s ease;
}
.chat__fab:hover { transform: translateY(-2px); }
.chat__fab .badge { background: #fff; color: var(--accent); }
.chat[data-open="true"] .chat__fab { display: none; }

.chat__panel {
    width: min(380px, calc(100vw - 2rem));
    height: min(580px, calc(100vh - 6rem));
    display: flex;
    flex-direction: column;
    background: var(--bg);
    border-radius: 18px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--line);
    overflow: hidden;
    animation: pop .18s ease-out;
}
.chat__panel[hidden] { display: none; }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.98); } }

.chat__header {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .9rem 1rem;
    background: var(--ink);
    color: var(--text-inverse);
}
.chat__header small { display: block; color: var(--text-inverse-muted); font-size: .75rem; line-height: 1.3; }
.avatar {
    flex: none;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-weight: 800;
}
.chat__close {
    margin-left: auto;
    background: none;
    border: none;
    color: inherit;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    opacity: .75;
}
.chat__close:hover { opacity: 1; }
.chat__body { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.chat__loading { padding: 1rem; color: var(--text-muted); }

.chat__messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: .55rem;
    background: var(--bg-alt);
}
.chat__messages--admin { height: min(60vh, 560px); border-radius: var(--radius-sm); border: 1px solid var(--line); }

.msg { max-width: 82%; display: flex; flex-direction: column; }
.msg p {
    margin: 0;
    padding: .6rem .85rem;
    border-radius: 14px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-size: .93rem;
    line-height: 1.45;
}
.msg time { font-size: .68rem; color: var(--text-muted); margin-top: .2rem; padding: 0 .3rem; }
.msg--mine { align-self: flex-end; align-items: flex-end; }
.msg--mine p { background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.msg--theirs { align-self: flex-start; }
.msg--theirs p { background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg--welcome p { background: var(--accent-soft); border-color: transparent; }

.chat__contact { border-top: 1px solid var(--line); padding: .5rem 1rem; font-size: .85rem; }
.chat__contact summary { cursor: pointer; font-weight: 600; color: var(--text-muted); }
.chat__contact .form { gap: .5rem; padding-top: .6rem; }
.chat__contact-done { margin: .5rem 0; color: var(--good); font-weight: 600; }

.chat__composer { display: flex; gap: .5rem; padding: .75rem; border-top: 1px solid var(--line); background: var(--bg); align-items: flex-end; }
.chat__composer textarea { flex: 1; resize: none; min-height: 2.6rem; max-height: 8rem; }
.chat__composer .btn { border-radius: var(--radius-sm); }

/* ---- Admin ----------------------------------------------------------------------- */

.admin { padding-block: 2rem 4rem; }
.admin h1 { font-size: 1.4rem; }
.admin__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; align-items: start; }
@media (max-width: 960px) { .admin__grid { grid-template-columns: 1fr; } }
.empty { padding: 2rem; text-align: center; color: var(--text-muted); background: var(--bg-alt); border-radius: var(--radius); }

.inbox { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff; }
.inbox__item + .inbox__item { border-top: 1px solid var(--line); }
.inbox__item { display: flex; align-items: center; }
.inbox__link { flex: 1; min-width: 0; display: block; padding: .9rem 1.1rem; color: inherit; text-decoration: none; }
.inbox__link:hover { background: var(--bg-alt); }
.inbox__item .icon-btn { margin-right: .6rem; opacity: 0; }
.inbox__item:hover .icon-btn, .inbox__item .icon-btn:focus-visible { opacity: 1; }
@media (hover: none) { .inbox__item .icon-btn { opacity: 1; } }
.inbox__item.is-unread { background: var(--accent-soft); }
.inbox__item.is-unread strong { color: var(--ink); }
.inbox__head { display: flex; gap: .6rem; align-items: baseline; flex-wrap: wrap; }
.inbox__head time { margin-left: auto; font-size: .78rem; color: var(--text-muted); }
.inbox__preview {
    display: flex;
    gap: .4rem;
    align-items: center;
    color: var(--text-muted);
    font-size: .9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.inbox__preview .badge { margin-left: auto; }

.leads { display: grid; gap: 1rem; }
.lead { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--radius-sm); padding: 1rem 1.2rem; }
.lead.is-handled { border-left-color: var(--line); opacity: .65; }
.lead header { display: flex; gap: .4rem; align-items: baseline; flex-wrap: wrap; }
.lead header time { margin-left: auto; font-size: .78rem; color: var(--text-muted); }
.lead__meta { font-size: .88rem; margin: .3rem 0 .6rem; }
.lead__msg { white-space: pre-wrap; font-size: .93rem; }

.conversation__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.conversation .chat__composer { padding: .75rem 0 0; border: none; }

.login { min-height: 60vh; display: grid; place-items: center; }
.login .form { width: min(400px, 100%); }
.login h1 { font-size: 1.4rem; }

.nav--admin .tag { background: var(--ink-3); color: var(--accent-2); }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
