/* ===== Variables de tema =====
   Modo claro por defecto; el modo oscuro se activa con <html data-theme="dark">
   (theme.js lo decide antes de pintar la página). */
:root {
    color-scheme: light;

    /* Paleta de marca */
    --navy: #2c3e66;        /* azul marino suave */
    --navy-dark: #1f2d4d;
    --beige: #f5ede0;       /* beige pastel */
    --beige-dark: #e8dcc8;
    --cyan: #a8e0e6;        /* cyan pastel */
    --cyan-dark: #6cc3cd;

    /* Colores semánticos */
    --bg: #ffffff;
    --bg-alt: var(--beige);
    --surface: #f2f5f9;     /* contenedores de texto: algo más oscuro que el blanco */
    --input-bg: #ffffff;
    --border: var(--beige-dark);
    --text: #3a4256;
    --text-soft: #5f6880;
    --heading: var(--navy);
    --accent: var(--cyan-dark);
    --accent-text: #2f8f99;  /* cian con contraste suficiente para texto */
    --chip: var(--cyan);     /* fondo de números, iconos y botón de contacto */
    --chip-hover: var(--cyan-dark);
    --on-chip: var(--navy);
    --btn-bg: var(--navy);
    --btn-bg-hover: var(--navy-dark);
    --btn-text: #ffffff;
    --nav-bg: rgba(255, 255, 255, 0.92);
    --tag-bg: rgba(255, 255, 255, 0.7);
    --hero-bg: linear-gradient(135deg, var(--beige) 0%, var(--cyan) 100%);
    --stat-bg: linear-gradient(135deg, #98d3da 0%, #ebe0cd 100%);
    --footer-bg: var(--navy);
    --footer-text: var(--beige);
    --footer-accent: var(--cyan);
    --ok: #2e7d5b;
    --error: #b54848;
    --focus: #2f8f99;

    --radius: 16px;
    --shadow: 0 8px 24px rgba(44, 62, 102, 0.08);
    /* Resplandor sutil en los bordes */
    --glow: 0 0 0 1px rgba(108, 195, 205, 0.45),
            0 0 18px rgba(108, 195, 205, 0.28);
    --glow-hover: 0 0 0 1px rgba(108, 195, 205, 0.7),
                  0 0 26px rgba(108, 195, 205, 0.42);
    --font: 'Poppins', sans-serif;
}

:root[data-theme="dark"] {
    color-scheme: dark;

    --bg: #121a2b;
    --bg-alt: #172136;
    --surface: #1c2740;
    --input-bg: #131c2f;
    --border: #33415f;
    --text: #dbe1ec;
    --text-soft: #a9b2c6;
    --heading: #eef2f8;
    --accent: #7fd0d9;
    --accent-text: #8fd8e0;
    --chip: var(--cyan);
    --chip-hover: #c6eef2;
    --on-chip: var(--navy-dark);
    --btn-bg: var(--cyan);
    --btn-bg-hover: #c6eef2;
    --btn-text: var(--navy-dark);
    --nav-bg: rgba(18, 26, 43, 0.9);
    --tag-bg: rgba(18, 26, 43, 0.55);
    --hero-bg: linear-gradient(135deg, #1f2d4d 0%, #1f4a57 100%);
    --stat-bg: linear-gradient(135deg, #22495a 0%, #3a3a4c 100%);
    --footer-bg: #0d1322;
    --footer-text: var(--beige);
    --footer-accent: var(--cyan);
    --ok: #6fd3a5;
    --error: #f2a0a0;
    --focus: #a8e0e6;

    --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    --glow: 0 0 0 1px rgba(127, 208, 217, 0.4),
            0 0 18px rgba(127, 208, 217, 0.18);
    --glow-hover: 0 0 0 1px rgba(127, 208, 217, 0.7),
                  0 0 26px rgba(127, 208, 217, 0.32);
}

/* Transición suave solo al cambiar de tema (theme.js añade la clase un instante). */
html.theme-anim,
html.theme-anim *,
html.theme-anim *::before,
html.theme-anim *::after {
    transition: background-color .35s ease, color .35s ease, border-color .35s ease,
                box-shadow .35s ease, fill .35s ease !important;
}

/* ===== Base ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 80px; }

body {
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
}

a { color: inherit; text-decoration: none; }

:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 3px;
    border-radius: 6px;
}

.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

.btn {
    display: inline-block;
    background: var(--btn-bg);
    color: var(--btn-text);
    padding: 14px 32px;
    border-radius: 50px;
    font-weight: 500;
    transition: background .2s, transform .2s;
}
.btn:hover { background: var(--btn-bg-hover); transform: translateY(-2px); }

/* ===== Navegación ===== */
.nav {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--nav-bg);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
}
.nav__inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    height: 70px;
}
.nav__logo { font-weight: 700; font-size: 1.25rem; color: var(--heading); white-space: nowrap; }
.nav__logo span { font-weight: 400; color: var(--accent); }
.nav__links { display: flex; gap: 28px; }
.nav__links a { font-size: .95rem; color: var(--text-soft); transition: color .2s; }
.nav__links a:hover { color: var(--heading); }

.nav__actions { display: flex; align-items: center; gap: 12px; }
.nav__contact {
    background: var(--chip);
    color: var(--on-chip);
    font-size: .85rem;
    font-weight: 600;
    padding: 8px 18px;
    border-radius: 50px;
    white-space: nowrap;
    transition: background .2s;
}
.nav__contact:hover { background: var(--chip-hover); }

/* Selector de idioma */
.lang-switch {
    display: flex;
    background: var(--surface);
    border-radius: 50px;
    padding: 3px;
    box-shadow: var(--glow);
}
.lang-switch button {
    font-family: var(--font);
    font-size: .8rem;
    font-weight: 600;
    color: var(--text-soft);
    background: transparent;
    border: 0;
    border-radius: 50px;
    padding: 6px 14px;
    cursor: pointer;
    transition: background .2s, color .2s;
}
.lang-switch button[aria-pressed="true"] { background: var(--btn-bg); color: var(--btn-text); }
.lang-switch button:not([aria-pressed="true"]):hover { color: var(--heading); }

/* Botón de tema */
.theme-toggle {
    flex: none;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: var(--surface);
    color: var(--heading);
    box-shadow: var(--glow);
    cursor: pointer;
    transition: box-shadow .2s, color .2s;
}
.theme-toggle:hover { box-shadow: var(--glow-hover); }
.theme-toggle svg { width: 20px; height: 20px; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ===== Hero ===== */
.hero {
    background: var(--hero-bg);
    padding: 120px 0;
    text-align: center;
}
.hero--full {                     /* página 404: ocupa toda la pantalla bajo la barra */
    min-height: calc(100vh - 71px);
    display: grid;
    place-items: center;
}
.hero__welcome {
    color: var(--heading);
    font-weight: 500;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-size: .9rem;
    margin-bottom: 12px;
}
.hero__title {
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 700;
    color: var(--heading);
    line-height: 1.1;
    margin-bottom: 16px;
}
.hero__slogan {
    font-size: clamp(1.1rem, 2.5vw, 1.4rem);
    font-weight: 300;
    color: var(--text);
    margin-bottom: 36px;
}

.hero__langs {
    margin-top: 36px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: var(--heading);
    font-weight: 500;
    font-size: .95rem;
}
.hero__lang-tags { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.hero__lang-tags span {
    background: var(--tag-bg);
    padding: 6px 18px;
    border-radius: 50px;
    font-size: .9rem;
    box-shadow: var(--glow);
}

/* ===== Secciones ===== */
.section { padding: 90px 0; }
.section--alt { background: var(--bg-alt); }
.section__title {
    text-align: center;
    font-size: clamp(1.8rem, 4vw, 2.4rem);
    font-weight: 600;
    color: var(--heading);
    margin-bottom: 8px;
}
.section__subtitle {
    text-align: center;
    color: var(--text-soft);
    margin-bottom: 50px;
}

/* ===== Cómo trabajamos ===== */
.steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
}
.step {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 28px 24px;
    text-align: center;
    box-shadow: var(--glow);
    transition: box-shadow .25s;
}
.step:hover { box-shadow: var(--glow-hover); }
.step__num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--chip);
    color: var(--on-chip);
    font-weight: 600;
    margin-bottom: 16px;
}
.step h3 { color: var(--heading); font-weight: 600; margin-bottom: 8px; }
.step p { font-size: .95rem; color: var(--text-soft); }

/* ===== Servicios ===== */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}
.card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 32px 28px;
    box-shadow: var(--glow), var(--shadow);
    border-top: 4px solid var(--cyan);
    transition: transform .2s, box-shadow .25s;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--glow-hover), var(--shadow); }
.card--featured { border-top-color: var(--heading); }
.card h3 { color: var(--heading); font-size: 1.3rem; font-weight: 600; margin-bottom: 8px; }
.card > p { color: var(--text-soft); margin-bottom: 20px; }
.card ul { list-style: none; }
.card li {
    position: relative;
    padding-left: 26px;
    margin-bottom: 10px;
    font-size: .95rem;
}
.card li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--accent-text);
    font-weight: 700;
}

.extras { margin-top: 56px; text-align: center; }
.extras h3 { color: var(--heading); font-weight: 600; margin-bottom: 20px; }
.extras__list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}
.extras__list span {
    background: var(--surface);
    border: 1px solid var(--accent);
    box-shadow: 0 0 12px rgba(108, 195, 205, 0.25);
    color: var(--heading);
    padding: 8px 20px;
    border-radius: 50px;
    font-size: .9rem;
}

/* ===== Sobre ===== */
.stats {
    display: flex;
    justify-content: center;
    gap: 32px;
    flex-wrap: wrap;
}
.stat {
    background: var(--stat-bg);
    border-radius: var(--radius);
    box-shadow: var(--glow);
    padding: 36px 48px;
    min-width: 220px;
    text-align: center;
    display: flex;
    flex-direction: column;
}
.stat__num { font-size: 3.5rem; font-weight: 700; color: var(--heading); line-height: 1; }
.stat__label { margin-top: 10px; color: var(--text); font-weight: 500; }

/* ===== Muestras de trabajo ===== */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}
.gallery img {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    background: var(--border); /* color de relleno mientras carga */
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: transform .2s;
}
.gallery img:hover { transform: scale(1.03); }
.gallery__note {
    max-width: 720px;
    margin: 40px auto 0;
    padding: 16px 24px;
    background: var(--surface);
    box-shadow: var(--glow);
    border-left: 4px solid var(--accent);
    border-radius: 8px;
    color: var(--text-soft);
    font-size: .95rem;
    text-align: center;
}

/* ===== Contacto ===== */
.contact {
    display: grid;
    grid-template-columns: 1fr 1.4fr;
    gap: 48px;
    align-items: start;
}
.contact__intro .section__title,
.contact__intro .section__subtitle { text-align: left; }
.contact__intro .section__subtitle { margin-bottom: 28px; }
.contact__info { list-style: none; display: grid; gap: 14px; }
.contact__info li { display: flex; align-items: center; gap: 12px; }
.contact__info a { color: var(--heading); font-weight: 500; word-break: break-word; }
.contact__info a:hover { color: var(--accent-text); }

/* Los iconos son azul marino: siempre van sobre un círculo cian para verse en ambos temas. */
.contact__info img,
.fab__option img {
    flex: none;
    box-sizing: content-box;
    padding: 7px;
    background: var(--chip);
    border-radius: 50%;
}

.contact__form {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--glow), var(--shadow);
    display: grid;
    gap: 18px;
}
.field { display: grid; gap: 6px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.field label { font-size: .85rem; font-weight: 500; color: var(--heading); }
.field input,
.field select,
.field textarea {
    font-family: var(--font);
    font-size: 1rem;              /* 16px evita el zoom automático en iPhone */
    color: var(--text);
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    width: 100%;
    transition: border-color .2s, box-shadow .2s;
}
.field textarea { resize: vertical; }
.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(108, 195, 205, 0.35);
}
.field [aria-invalid="true"] { border-color: var(--error); }
.field__error { font-size: .8rem; color: var(--error); }
.field__error:empty { display: none; }
.field__count { font-size: .75rem; color: var(--text-soft); text-align: right; }

/* Campo trampa: fuera de la vista y del árbol de accesibilidad */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.btn--full { width: 100%; border: 0; cursor: pointer; font-family: var(--font); font-size: 1rem; }
.btn--full:disabled { opacity: .6; cursor: wait; transform: none; }
.form__status { font-size: .9rem; text-align: center; min-height: 1.4em; color: var(--text-soft); }
.form__status--ok { color: var(--ok); }
.form__status--error { color: var(--error); }

/* ===== Pie de página ===== */
.footer { background: var(--footer-bg); color: var(--footer-text); padding: 40px 0; }
.footer__inner {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}
.footer__brand { font-weight: 700; font-size: 1.1rem; }
.footer__brand span { font-weight: 400; color: var(--footer-accent); }
.footer__social { display: flex; gap: 14px; }
.footer__social a {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    background: var(--beige);
    border-radius: 50%;
    transition: transform .2s, box-shadow .2s;
}
.footer__social a:hover { transform: translateY(-3px); box-shadow: 0 0 16px rgba(168, 224, 230, 0.6); }
.footer__social a:focus-visible { outline-color: var(--cyan); }
.footer__copy { font-size: .85rem; opacity: .85; }

/* ===== Botón flotante (solo pantallas táctiles) ===== */
.fab { display: none; }
@media (hover: none) and (pointer: coarse) {
    .fab {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        gap: 12px;
        position: fixed;
        right: 18px;
        bottom: 18px;
        z-index: 20;
    }
    .footer { padding-bottom: 100px; } /* que el botón no tape el pie */
}
.fab__toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 0;
    background: var(--navy);
    display: grid;
    place-items: center;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3), 0 0 0 4px rgba(168, 224, 230, 0.5);
}
.fab__menu { display: grid; gap: 10px; }
.fab__menu[hidden] { display: none; }
.fab__option {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface);
    color: var(--heading);
    font-weight: 600;
    padding: 10px 18px 10px 10px;
    border-radius: 50px;
    box-shadow: var(--glow), var(--shadow);
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
    .nav__links { display: none; }   /* sin espacio para los enlaces: se partirían en varias líneas */
}
@media (max-width: 860px) {
    .contact { grid-template-columns: 1fr; gap: 32px; }
}
@media (max-width: 640px) {
    .field-row { grid-template-columns: 1fr; }
    .contact__form { padding: 24px 20px; }
    .footer__inner { flex-direction: column; text-align: center; }
    .hero { padding: 80px 0; }
    .section { padding: 64px 0; }
}
@media (max-width: 420px) {
    .container { padding: 0 16px; }
    .nav__logo span { display: none; }
    .nav__actions { gap: 8px; }
    .nav__contact { padding: 8px 12px; }
    .lang-switch button { padding: 6px 10px; }
    .theme-toggle { width: 36px; height: 36px; }
}

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