/* Morales Schmidt LLC — sitio público
 *
 * Implementation of the Claude Design canvas `Sitio Morales Schmidt.dc.html`
 * (project "Website design planning"). The canvas is kept alongside this file
 * for reference; it runs on the dc-runtime in support.js. This file is the real
 * thing: plain React over the design-system bundle, no canvas runtime.
 *
 * Everything visual comes from the design system — components off
 * window.MoralesSchmidtDesignSystem_9a693b, colour/type/space from its tokens.
 * No raw hex, no font-family literals.
 */

const DS = window.MoralesSchmidtDesignSystem_9a693b;
const {
  Button, Icon, Card, Tag, Alert,
  Field, Input, Select, Textarea,
  SectionHeading, PracticeAreaCard, Quote, Stat,
} = DS;
const { useState, useCallback, useEffect } = React;

/* ── Configuration ────────────────────────────────────────────────────────
   Overridable by query string:  ?cols=4  ?lang=en

   The canvas also carried a second home hero ("B · Editorial") behind a
   homeDirection prop and a floating A/B switcher. The firm chose the navy
   direction, so both are gone — HeroNavy is now simply the hero.           */
const Q = new URLSearchParams(location.search);
const clamp = (n, lo, hi) => Math.min(hi, Math.max(lo, n));

const CONFIG = {
  servicesColumns: clamp(parseInt(Q.get("cols"), 10) || 3, 2, 4),
  initialLang: Q.get("lang") === "en" ? "en" : "es",
};

/* ── Content ──────────────────────────────────────────────────────────────
   Firm copy from moralesschmidt.com, as carried by the canvas. Service
   descriptions are one-line summaries written for the layout — the live site
   lists service names only.                                                 */

/* Servicios page — filterable, each card links to Contacto. */
const AREAS = [
  { icon: "shield",     title: "Derecho penal",      cat: "Penal",       description: "Representación en procedimientos criminales estatales y federales." },
  { icon: "users",      title: "Derecho de familia", cat: "Familia",     description: "Divorcios, custodia, pensiones alimentarias y otros asuntos ante los tribunales de Puerto Rico." },
  { icon: "landmark",   title: "Sucesiones",         cat: "Familia",     description: "Declaratorias de herederos, particiones y trámites sucesorales." },
  { icon: "file-text",  title: "Daños y perjuicios", cat: "Civil",       description: "Reclamaciones por daños en la esfera civil, estatal y federal." },
  { icon: "briefcase",  title: "Contratos",          cat: "Empresarial", description: "Redacción, interpretación y ejecución de contratos, incluyendo construcción." },
  { icon: "building-2", title: "Laboral",            cat: "Empresarial", description: "Controversias laborales y asesoría a patronos y empleados." },
  { icon: "stamp",      title: "Notaría",            cat: "Notarial",    description: "Escrituras, poderes, testamentos y declaraciones juradas." },
];

/* Inicio grid — shorter descriptions, cards link through to Servicios.
   Deliberately a separate list: the canvas authors these two grids apart. */
const HOME_AREAS = [
  { icon: "shield",     title: "Derecho penal",      description: "Representación en procedimientos criminales estatales y federales." },
  { icon: "users",      title: "Derecho de familia", description: "Divorcios, custodia, pensiones alimentarias y otros asuntos de familia." },
  { icon: "landmark",   title: "Sucesiones",         description: "Declaratorias de herederos, particiones y trámites sucesorales." },
  { icon: "file-text",  title: "Daños y perjuicios", description: "Reclamaciones por daños en la esfera civil." },
  { icon: "briefcase",  title: "Contratos",          description: "Redacción, interpretación y ejecución de contratos, incluyendo construcción." },
  { icon: "building-2", title: "Laboral",            description: "Controversias laborales y asesoría a patronos y empleados." },
  { icon: "stamp",      title: "Notaría",            description: "Escrituras, poderes, testamentos y declaraciones juradas." },
];

const FILTERS = ["Todos", "Penal", "Civil", "Familia", "Empresarial", "Notarial"];
const NAV = ["Inicio", "Servicios", "El bufete", "Contacto"];
const SUBJECTS = ["Consulta general", "Derecho penal", "Derecho de familia", "Sucesiones", "Daños y perjuicios", "Contratos", "Laboral", "Notaría"];

const OFFICE = {
  address: "Urb. Santa Cruz 47, Esteban Padilla, Suite 1, Bayamón, PR 00961",
  addressShort: "Urb. Santa Cruz 47, Esteban Padilla, Suite 1, Bayamón",
  hours: "Lunes a viernes, 9:00 am a 6:00 pm",
  phone: "+1-787-993-2109",
  tel: "+17879932109",
  fax: "+1-787-946-1767",
  email: "lcdo.manuelmorales@delgado-morales.com",
};

/* English is an equal-quality translation, not a machine pass (see the design
   system readme). Dictionary carried over from the canvas. */
const EN = {
  "Inicio": "Home", "Servicios": "Services", "El bufete": "The firm", "Contacto": "Contact",
  "Filtrar": "Filter", "Todos": "All", "Penal": "Criminal", "Civil": "Civil", "Familia": "Family",
  "Empresarial": "Business", "Notarial": "Notarial",
  "Lunes a viernes, 9:00 am a 6:00 pm": "Monday to Friday, 9:00 am to 6:00 pm",
  "Asesoría personalizada": "Personal consultation",
  "Desde 2012 · Estatal y federal": "Since 2012 · State and federal",
  "Bufete de Abogados y Notaría a su servicio": "A law office and notary at your service",
  "Asesoría legal, estatal y federal en toda la Isla, desde nuestra oficina en Bayamón.": "State and federal legal advice across the Island, from our office in Bayamón.",
  "También por WhatsApp, de lunes a viernes.": "Also on WhatsApp, Monday to Friday.",
  "Contáctenos": "Contact us",
  "Urb. Santa Cruz 47, Esteban Padilla, Suite 1, Bayamón, PR 00961": "Urb. Santa Cruz 47, Esteban Padilla, Suite 1, Bayamón, PR 00961",
  "Enviar consulta": "Send an inquiry",
  "Respuesta desde la oficina de Bayamón.": "Answered from the Bayamón office.",
  "Áreas de práctica": "Practice areas",
  "Oficina · toda la Isla": "Office · island-wide", "En funciones desde": "In practice since", "Foros": "Forums",
  "Ver servicios": "View services",
  "Retrato · pendiente": "Portrait · pending",
  "La atención y confianza que requiere": "The attention and confidence you require",
  "El Lcdo. Morales Schmidt es el titular de este Bufete de abogados y Notaría en Bayamón. Desde 2012 su grupo de abogados brinda asesoría legal, estatal y federal en toda la Isla.": "Lcdo. Morales Schmidt is the principal of this law office and notary in Bayamón. Since 2012 his group of attorneys has provided state and federal legal advice across the Island.",
  "Conozca nuestros servicios y pónganse en contacto con nuestro personal.": "Review our services and get in touch with our staff.",
  "Titular del bufete": "Principal attorney",
  "Juris doctor de la Pontificia Universidad Católica de Puerto Rico, Summa Cum Laude, y estudiante de más alto promedio de su clase graduanda. Antes de estudiar derecho obtuvo un bachillerato en ingeniería aeroespacial de la Universidad Texas A&M.": "Juris doctor from the Pontifical Catholic University of Puerto Rico, Summa Cum Laude, and highest-ranked student of his graduating class. Before studying law he earned a bachelor's degree in aerospace engineering from Texas A&M University.",
  "Conocer su trayectoria": "Read his background",
  "Selección de servicios legales y notariales": "A selection of legal and notarial services",
  "Una alternativa profesional para asuntos criminales, civiles, laborales y notariales.": "A professional alternative for criminal, civil, employment and notarial matters.",
  "Representación en procedimientos criminales estatales y federales.": "Representation in state and federal criminal proceedings.",
  "Divorcios, custodia, pensiones alimentarias y otros asuntos de familia.": "Divorce, custody, child support and other family matters.",
  "Divorcios, custodia, pensiones alimentarias y otros asuntos ante los tribunales de Puerto Rico.": "Divorce, custody, child support and other matters before the courts of Puerto Rico.",
  "Declaratorias de herederos, particiones y trámites sucesorales.": "Declarations of heirs, partitions and estate proceedings.",
  "Reclamaciones por daños en la esfera civil.": "Civil damages claims.",
  "Reclamaciones por daños en la esfera civil, estatal y federal.": "Civil damages claims, state and federal.",
  "Redacción, interpretación y ejecución de contratos, incluyendo construcción.": "Drafting, interpretation and enforcement of contracts, including construction.",
  "Controversias laborales y asesoría a patronos y empleados.": "Employment disputes and advice for employers and employees.",
  "Escrituras, poderes, testamentos y declaraciones juradas.": "Deeds, powers of attorney, wills and sworn statements.",
  "Derecho penal": "Criminal law", "Derecho de familia": "Family law", "Sucesiones": "Estates",
  "Daños y perjuicios": "Damages", "Contratos": "Contracts", "Laboral": "Employment", "Notaría": "Notary",
  "¿No encuentra su asunto?": "Don't see your matter?",
  "Escríbanos y le indicamos si podemos atenderle o a quién referirle.": "Write to us and we will tell you whether we can help or whom to refer you to.",
  "Leemos sus dudas y comentarios": "We read your questions and comments",
  "Llame, escriba por WhatsApp o envíe el formulario. Le responderemos desde la oficina de Bayamón.": "Call, message on WhatsApp or send the form. We will reply from the Bayamón office.",
  "Escribir al bufete": "Write to the firm",
  "Asuntos criminales, civiles, de familia, laborales y notariales, ante los tribunales estatales y federales de Puerto Rico.": "Criminal, civil, family, employment and notarial matters before the state and federal courts of Puerto Rico.",
  "Construcción y permisos": "Construction and permitting",
  "Contratos de construcción, permisos y reclamaciones de obra": "Construction contracts, permits and construction claims",
  "Antes de estudiar derecho, el Lcdo. Morales Schmidt obtuvo un bachillerato en ingeniería aeroespacial de la Universidad Texas A&M. Esa formación técnica se aplica a la redacción y ejecución de contratos de obra, trámites de permisos y controversias entre dueños, contratistas y subcontratistas.": "Before studying law, Lcdo. Morales Schmidt earned a bachelor's degree in aerospace engineering from Texas A&M University. That technical background applies to drafting and enforcing construction contracts, permit filings and disputes among owners, contractors and subcontractors.",
  "Explíquenos su situación y le indicamos el próximo paso y el costo antes de comenzar.": "Explain your situation and we will set out the next step and the cost before starting.",
  "+1-787-993-2109 · lunes a viernes, 9:00 am a 6:00 pm": "+1-787-993-2109 · Monday to Friday, 9:00 am to 6:00 pm",
  "La información de esta página es general y no constituye asesoría legal.": "The information on this page is general and does not constitute legal advice.",
  "Una alternativa profesional": "A professional alternative",
  "Bufete de abogados y notaría en Bayamón, en funciones desde 2012.": "Law office and notary in Bayamón, in practice since 2012.",
  "Tribunales estatales y federales": "State and federal courts",
  "Servicios en toda la Isla": "Service across the Island",
  "Es juris doctor de la Pontificia Universidad Católica de Puerto Rico, Summa Cum Laude, y fue el estudiante de más alto promedio de su clase graduanda. Antes de estudiar derecho obtuvo un bachillerato en ingeniería aeroespacial de la Universidad Texas A&M, formación que aplica hoy a los asuntos de construcción y permisos.": "He is a juris doctor from the Pontifical Catholic University of Puerto Rico, Summa Cum Laude, and was the highest-ranked student of his graduating class. Before studying law he earned a bachelor's degree in aerospace engineering from Texas A&M University, training he applies today to construction and permitting matters.",
  "No prometemos resultados. Prometemos que usted va a entender su caso en cada etapa.": "We do not promise outcomes. We promise that you will understand your case at every stage.",
  "Cómo trabajamos": "How we work",
  "Lo que puede esperar del bufete": "What you can expect from the firm",
  "Un solo punto de contacto": "A single point of contact",
  "Usted sabe con quién habla y a quién llamar durante todo el trámite.": "You know who you are speaking with and whom to call throughout the matter.",
  "Estimado por escrito": "A written estimate",
  "Antes de comenzar recibirá el alcance del trabajo y el costo, por escrito.": "Before starting you receive the scope of work and the cost, in writing.",
  "Lenguaje llano": "Plain language",
  "Le explicamos el procedimiento en palabras corrientes y guardamos el vocabulario técnico para los documentos.": "We explain the procedure in everyday words and save the technical vocabulary for the documents.",
  "Escriba su consulta y le responderemos desde la oficina de Bayamón.": "Write your inquiry and we will reply from the Bayamón office.",
  "Nombre": "Name", "Correo electrónico": "Email", "Teléfono": "Phone", "Asunto": "Subject", "Mensaje": "Message",
  "Nombre y apellidos": "Full name", "Escriba aquí su consulta": "Write your inquiry here",
  "Describa brevemente su situación. No incluya información confidencial en este formulario.": "Briefly describe your situation. Do not include confidential information in this form.",
  "Enviar este formulario no crea una relación abogado-cliente.": "Sending this form does not create an attorney-client relationship.",
  "Enviar": "Send", "Enviando…": "Sending…", "Recibimos su consulta": "We received your inquiry",
  "No pudimos enviar su consulta.": "We could not send your inquiry.",
  "Inténtelo de nuevo en un momento o llámenos al +1-787-993-2109.": "Try again in a moment, or call us at +1-787-993-2109.",
  "Le responderemos durante el horario de oficina, de lunes a viernes.": "We will reply during office hours, Monday to Friday.",
  "Formato de correo inválido.": "Invalid email format.",
  "La oficina": "The office",
  "+1-787-993-2109 · WhatsApp": "+1-787-993-2109 · WhatsApp",
  "Llamar al bufete": "Call the firm", "Escribir por WhatsApp": "Message on WhatsApp",
  "Mapa · Bayamón": "Map · Bayamón",
  "Bufete de abogados y notaría en Bayamón. Asesoría legal, estatal y federal en toda la Isla.": "Law office and notary in Bayamón. State and federal legal advice across the Island.",
  "Bufete": "Firm", "Oficina": "Office",
  "© 2026 Lcdo. Morales Schmidt. Todos los derechos reservados.": "© 2026 Lcdo. Morales Schmidt. All rights reserved.",
  "Este sitio es informativo y no constituye asesoría legal.": "This site is informational and does not constitute legal advice.",
  /* Added here, not in the canvas. The first three the canvas left untranslated,
     so they showed as Spanish inside an otherwise English page. The last two are
     new copy — see the required-field validation below. Both need firm sign-off. */
  "Consulta general": "General inquiry",
  "Estatal y federal": "State and federal",
  "nombre@correo.com": "name@email.com",
  "Escriba su nombre.": "Enter your name.",
  "Escriba su mensaje.": "Enter your message.",
};

/* ── Shared bits ──────────────────────────────────────────────────────────*/

const EYEBROW = { font: "var(--text-eyebrow)", letterSpacing: "var(--ls-eyebrow)", textTransform: "uppercase" };

function IconLine({ icon, color = "var(--gold-400)", children, style }) {
  return (
    <span style={{ display: "flex", gap: "var(--space-3)", alignItems: "flex-start", font: "var(--fw-regular) 15px/1.6 var(--font-body)", color: "var(--navy-100)", ...style }}>
      <Icon name={icon} size="sm" color={color} style={{ marginTop: 2 }} />
      {children}
    </span>
  );
}

/* Placeholder for artwork the firm has not supplied. The design system is
   explicit that no photography exists yet and that stock must not stand in. */
function PhotoSlot({ caption, monogramWidth = 140, style }) {
  return (
    <div style={{ position: "relative", background: "var(--surface-sunken)", border: "1px solid var(--border-subtle)", display: "flex", alignItems: "center", justifyContent: "center", ...style }}>
      <img src="assets/monogram-navy.png" alt="" style={{ width: monogramWidth, maxWidth: "60%", opacity: 0.12 }} />
      <span style={{ position: "absolute", left: 20, bottom: 18, font: "var(--fw-medium) 11px/1 var(--font-body)", letterSpacing: "0.14em", textTransform: "uppercase", color: "var(--ink-500)" }}>{caption}</span>
    </div>
  );
}

/* ── Chrome ───────────────────────────────────────────────────────────────*/

function SiteHeader({ page, go, lang, setLang, t }) {
  const langBtn = (code, label) => (
    <button
      type="button"
      onClick={() => setLang(code)}
      aria-pressed={lang === code}
      lang={code}
      style={{
        border: 0, background: "transparent", cursor: "pointer", padding: 0,
        font: "var(--fw-semibold) 11.5px/1 var(--font-body)", letterSpacing: "0.14em", textTransform: "uppercase",
        color: lang === code ? "var(--gold-400)" : "var(--navy-300)",
        transition: "var(--transition-control)",
      }}
    >{label}</button>
  );

  return (
    <header style={{ position: "sticky", top: 0, zIndex: 30, background: "var(--white)", borderBottom: "1px solid var(--border-subtle)" }}>
      <div className="ms-utility" style={{ display: "flex", alignItems: "center", justifyContent: "space-between", gap: "var(--space-7)", minHeight: 44, padding: "0 var(--space-7)", background: "var(--navy-900)", color: "var(--navy-200)" }}>
        <div className="ms-utility-info" style={{ display: "flex", alignItems: "center", gap: "var(--space-6)", font: "var(--fw-regular) 12.5px/1 var(--font-body)" }}>
          <span style={{ display: "inline-flex", alignItems: "center", gap: "var(--space-2)" }}>
            <Icon name="map-pin" size="xs" color="var(--gold-400)" />{OFFICE.addressShort}
          </span>
          <span style={{ display: "inline-flex", alignItems: "center", gap: "var(--space-2)" }}>
            <Icon name="clock" size="xs" color="var(--gold-400)" />{t(OFFICE.hours)}
          </span>
        </div>
        <div className="ms-utility-actions" style={{ display: "flex", alignItems: "center", gap: 18, whiteSpace: "nowrap", marginLeft: "auto" }}>
          <div style={{ display: "flex", alignItems: "center", gap: "var(--space-2)", paddingRight: 18, borderRight: "1px solid var(--navy-800)" }}>
            {langBtn("es", "ES")}
            <span style={{ color: "var(--navy-700)", fontSize: 11 }} aria-hidden="true">/</span>
            {langBtn("en", "EN")}
          </div>
          <a href={"tel:" + OFFICE.tel} className="ms-plain-link" style={{ color: "var(--white)", font: "var(--fw-medium) 12.5px/1 var(--font-body)", display: "inline-flex", alignItems: "center", gap: "var(--space-2)", padding: "10px 0" }}>
            <Icon name="phone" size="xs" color="var(--gold-400)" />{OFFICE.phone}
          </a>
        </div>
      </div>

      <div className="ms-container ms-header-bar" style={{ display: "flex", alignItems: "center", justifyContent: "space-between", minHeight: 88, padding: "var(--space-3) var(--space-7)", gap: "var(--space-6)" }}>
        <a href="#" onClick={go("Inicio")} className="ms-plain-link" style={{ display: "flex", flex: "0 0 auto" }} aria-label={"Morales Schmidt LLC — " + t("Inicio")}>
          <img src="assets/logo-navy.png" alt="Morales Schmidt LLC" style={{ height: 58, width: "auto", display: "block" }} />
        </a>
        <nav className="ms-nav" style={{ display: "flex", alignItems: "center", gap: 34 }} aria-label={t("Bufete")}>
          {NAV.map((item) => (
            <a
              key={item}
              href="#"
              onClick={go(item)}
              className="ms-plain-link"
              aria-current={page === item ? "page" : undefined}
              style={{
                paddingBottom: 4,
                font: "var(--fw-medium) 14px/1 var(--font-body)",
                color: page === item ? "var(--navy-800)" : "var(--ink-600)",
                borderBottom: "2px solid " + (page === item ? "var(--accent)" : "transparent"),
                transition: "var(--transition-control)",
              }}
            >{t(item)}</a>
          ))}
          <span className="ms-nav-cta">
            <Button size="sm" iconRight="arrow-right" onClick={go("Contacto")}>{t("Asesoría personalizada")}</Button>
          </span>
        </nav>
      </div>
    </header>
  );
}

function SiteFooter({ go, t }) {
  const link = (label, target) => (
    <a key={label} href="#" onClick={go(target)} className="ms-footer-link" style={{ font: "var(--fw-regular) 13.5px/1.5 var(--font-body)" }}>{t(label)}</a>
  );
  const colHead = (label) => (
    <span style={{ ...EYEBROW, font: "var(--fw-semibold) 11.5px/1 var(--font-body)", letterSpacing: "0.14em", color: "var(--gold-400)" }}>{t(label)}</span>
  );

  /* Literal px appears throughout this file wherever the canvas authored a value
     the 4px token scale has no step for — it jumps 56 → 72 → 96, so 64, 80, 48,
     44, 26, 10 and 6 have no token. The approved design wins over rounding. */
  return (
    <footer style={{ background: "var(--surface-deep)", color: "var(--navy-200)", padding: "64px var(--space-7) var(--space-7)" }}>
      <div className="ms-container ms-footer-grid">
        <div style={{ display: "flex", flexDirection: "column", gap: 18 }}>
          <img src="assets/logo-white.png" alt="Morales Schmidt LLC" style={{ height: 82, width: "auto", alignSelf: "flex-start", maxWidth: "100%" }} />
          <p style={{ margin: 0, font: "var(--fw-regular) 13px/1.7 var(--font-body)", color: "var(--navy-300)", maxWidth: 280 }}>
            {t("Bufete de abogados y notaría en Bayamón. Asesoría legal, estatal y federal en toda la Isla.")}
          </p>
        </div>

        <div style={{ display: "flex", flexDirection: "column", gap: "var(--space-3)" }}>
          {colHead("Servicios")}
          {AREAS.map((a) => link(a.title, "Servicios"))}
        </div>

        <div style={{ display: "flex", flexDirection: "column", gap: "var(--space-3)" }}>
          {colHead("Bufete")}
          {NAV.map((item) => link(item, item))}
        </div>

        <div style={{ display: "flex", flexDirection: "column", gap: "var(--space-3)", font: "var(--fw-regular) 13.5px/1.6 var(--font-body)" }}>
          {colHead("Oficina")}
          <span>Urb. Santa Cruz 47, Esteban Padilla,<br />Suite 1, Bayamón, PR 00961</span>
          <span style={{ display: "inline-flex", alignItems: "center", gap: "var(--space-2)" }}>
            <Icon name="phone" size="xs" color="var(--gold-400)" />{OFFICE.phone}
          </span>
          <span style={{ display: "inline-flex", alignItems: "center", gap: "var(--space-2)" }}>
            <Icon name="file-text" size="xs" color="var(--gold-400)" />Fax: {OFFICE.fax}
          </span>
          <span style={{ display: "inline-flex", alignItems: "center", gap: "var(--space-2)", wordBreak: "break-all" }}>
            <Icon name="mail" size="xs" color="var(--gold-400)" />{OFFICE.email}
          </span>
        </div>
      </div>

      <div className="ms-container" style={{ marginTop: "48px", paddingTop: "var(--space-5)", borderTop: "1px solid var(--navy-800)", display: "flex", justifyContent: "space-between", flexWrap: "wrap", gap: "var(--space-6)", font: "var(--fw-regular) 12px/1.5 var(--font-body)", color: "var(--navy-300)" }}>
        <span>{t("© 2026 Lcdo. Morales Schmidt. Todos los derechos reservados.")}</span>
        <span>{t("Este sitio es informativo y no constituye asesoría legal.")}</span>
      </div>
    </footer>
  );
}

/* ── Inicio ───────────────────────────────────────────────────────────────*/

/* Navy hero with the monogram watermark and a floating consultation card
   (the design system's one sanctioned use of blur). */
function HeroNavy({ go, t }) {
  return (
    <section style={{ position: "relative", background: "var(--surface-deep)", color: "var(--white)", overflow: "hidden" }}>
      <div style={{ position: "absolute", inset: 0, backgroundImage: "linear-gradient(115deg, rgba(6,36,53,.97) 0%, rgba(6,36,53,.74) 55%, rgba(10,74,110,.55) 100%)" }} />
      <img src="assets/monogram-white.png" alt="" aria-hidden="true" style={{ position: "absolute", right: -90, top: -60, width: 620, opacity: 0.07, pointerEvents: "none" }} />
      <div className="ms-container ms-hero-grid ms-hero-pad" style={{ position: "relative", padding: "112px var(--space-7) var(--space-11)" }}>
        <div style={{ display: "flex", flexDirection: "column", gap: "var(--space-6)", alignItems: "flex-start" }}>
          <span style={{ ...EYEBROW, color: "var(--gold-400)" }}>{t("Desde 2012 · Estatal y federal")}</span>
          <h1 style={{ margin: 0, font: "var(--text-display)", color: "var(--white)", maxWidth: 640, textWrap: "pretty" }}>
            {t("Bufete de Abogados y Notaría a su servicio")}
          </h1>
          <p style={{ margin: 0, maxWidth: 520, font: "var(--fw-regular) var(--fs-lead)/var(--lh-lead) var(--font-body)", color: "var(--navy-200)" }}>
            {t("Asesoría legal, estatal y federal en toda la Isla, desde nuestra oficina en Bayamón.")}
          </p>
          <div style={{ display: "flex", gap: 14, marginTop: "var(--space-2)", flexWrap: "wrap" }}>
            <Button variant="gold" size="lg" iconRight="arrow-right" onClick={go("Contacto")}>{t("Asesoría personalizada")}</Button>
            <Button variant="inverse" size="lg" iconLeft="phone" onClick={() => { location.href = "tel:" + OFFICE.tel; }}>{OFFICE.phone}</Button>
          </div>
          <span style={{ display: "inline-flex", alignItems: "center", gap: "var(--space-2)", font: "var(--fw-regular) var(--fs-small)/1.4 var(--font-body)", color: "var(--navy-300)" }}>
            {t("También por WhatsApp, de lunes a viernes.")}
          </span>
        </div>

        <div style={{ background: "rgba(255,255,255,.06)", border: "1px solid rgba(255,255,255,.14)", borderTop: "var(--rule-width) solid var(--accent)", borderRadius: "var(--radius-md)", padding: "var(--space-7)", backdropFilter: "blur(6px)", WebkitBackdropFilter: "blur(6px)" }}>
          <span style={{ ...EYEBROW, color: "var(--gold-400)" }}>{t("Contáctenos")}</span>
          <ul style={{ listStyle: "none", padding: 0, margin: "var(--space-5) 0 0", display: "flex", flexDirection: "column", gap: "var(--space-4)" }}>
            <li><IconLine icon="map-pin">{t(OFFICE.address)}</IconLine></li>
            <li><IconLine icon="clock">{t(OFFICE.hours)}</IconLine></li>
            <li><IconLine icon="phone">{OFFICE.phone} · Fax {OFFICE.fax}</IconLine></li>
          </ul>
          <div style={{ marginTop: 26, paddingTop: "var(--space-5)", borderTop: "1px solid rgba(255,255,255,.14)", display: "flex", flexDirection: "column", gap: "var(--space-3)" }}>
            <Button variant="inverse" fullWidth onClick={go("Contacto")}>{t("Enviar consulta")}</Button>
            <span style={{ textAlign: "center", font: "var(--fw-regular) 12.5px/1.5 var(--font-body)", color: "var(--navy-300)" }}>
              {t("Respuesta desde la oficina de Bayamón.")}
            </span>
          </div>
        </div>
      </div>
    </section>
  );
}

function HomeScreen({ go, t }) {
  return (
    <main data-screen-label="Inicio">
      <HeroNavy go={go} t={t} />

      <section style={{ background: "var(--surface-sunken)", borderBottom: "1px solid var(--navy-100)", padding: "88px var(--space-7)" }}>
        <div className="ms-container ms-firm-grid">
          <div style={{ display: "flex", flexDirection: "column", gap: "var(--space-6)", alignItems: "flex-start" }}>
            <SectionHeading eyebrow={t("El bufete")} title={t("La atención y confianza que requiere")} />
            <p style={{ margin: 0, maxWidth: "58ch", font: "var(--fw-regular) 17px/1.7 var(--font-body)", color: "var(--text-body)" }}>
              {t("El Lcdo. Morales Schmidt es el titular de este Bufete de abogados y Notaría en Bayamón. Desde 2012 su grupo de abogados brinda asesoría legal, estatal y federal en toda la Isla.")}
            </p>
            <p style={{ margin: 0, maxWidth: "58ch", font: "var(--fw-regular) 17px/1.7 var(--font-body)", color: "var(--text-body)" }}>
              {t("Conozca nuestros servicios y pónganse en contacto con nuestro personal.")}
            </p>
            <Button variant="secondary" onClick={go("Servicios")}>{t("Ver servicios")}</Button>
          </div>
          <Card padding="36px" topRule>
            <span style={{ ...EYEBROW, font: "var(--fw-semibold) 11.5px/1 var(--font-body)", letterSpacing: "0.14em", color: "var(--accent)" }}>{t("Titular del bufete")}</span>
            <h3 style={{ margin: "14px 0 var(--space-3)", font: "var(--fw-semibold) 28px/1.2 var(--font-display)", color: "var(--text-heading)" }}>Manuel L. Morales Schmidt</h3>
            <p style={{ margin: "0 0 var(--space-5)", font: "var(--fw-regular) 15px/1.7 var(--font-body)", color: "var(--text-muted)" }}>
              {t("Juris doctor de la Pontificia Universidad Católica de Puerto Rico, Summa Cum Laude, y estudiante de más alto promedio de su clase graduanda. Antes de estudiar derecho obtuvo un bachillerato en ingeniería aeroespacial de la Universidad Texas A&M.")}
            </p>
            <Button variant="ghost" iconRight="arrow-right" onClick={go("El bufete")}>{t("Conocer su trayectoria")}</Button>
          </Card>
        </div>
      </section>

      <section className="ms-container" style={{ padding: "var(--space-11) var(--space-7)" }}>
        <SectionHeading
          eyebrow={t("Servicios")}
          title={t("Selección de servicios legales y notariales")}
          description={t("Una alternativa profesional para asuntos criminales, civiles, laborales y notariales.")}
        />
        <div className="ms-cards-3" style={{ marginTop: "48px" }}>
          {HOME_AREAS.map((a) => (
            <PracticeAreaCard
              key={a.title}
              icon={a.icon}
              title={t(a.title)}
              description={t(a.description)}
              linkLabel={t("Ver servicios")}
              onClick={go("Servicios")}
            />
          ))}
          <div style={{ display: "flex", flexDirection: "column", justifyContent: "center", gap: "var(--space-4)", padding: "var(--space-7)", background: "var(--surface-sunken)", border: "1px solid var(--navy-100)", borderTop: "var(--rule-width) solid var(--accent)", borderRadius: "var(--radius-md)" }}>
            <h3 style={{ margin: 0, font: "var(--fw-semibold) 22px/1.25 var(--font-display)", color: "var(--text-heading)" }}>{t("¿No encuentra su asunto?")}</h3>
            <p style={{ margin: 0, font: "var(--fw-regular) 14.5px/1.65 var(--font-body)", color: "var(--text-muted)" }}>
              {t("Escríbanos y le indicamos si podemos atenderle o a quién referirle.")}
            </p>
            <Button variant="ghost" iconRight="arrow-right" onClick={go("Contacto")}>{t("Contáctenos")}</Button>
          </div>
        </div>
      </section>

      <section style={{ background: "var(--surface-brand)", padding: "var(--space-10) var(--space-7)" }}>
        <div className="ms-container ms-cta-grid">
          <div style={{ display: "flex", flexDirection: "column", gap: "var(--space-3)" }}>
            <h2 style={{ margin: 0, font: "var(--text-h1)", color: "var(--white)" }}>{t("Leemos sus dudas y comentarios")}</h2>
            <p style={{ margin: 0, font: "var(--fw-regular) 17px/1.6 var(--font-body)", color: "var(--navy-100)" }}>
              {t("Llame, escriba por WhatsApp o envíe el formulario. Le responderemos desde la oficina de Bayamón.")}
            </p>
          </div>
          <div style={{ display: "flex", gap: 14, flexWrap: "wrap" }}>
            <Button variant="inverse" size="lg" onClick={go("Contacto")}>{t("Escribir al bufete")}</Button>
            <Button variant="gold" size="lg" iconLeft="phone" onClick={() => { location.href = "tel:" + OFFICE.tel; }}>{OFFICE.phone}</Button>
          </div>
        </div>
      </section>
    </main>
  );
}

/* ── Servicios ────────────────────────────────────────────────────────────*/

function ServicesScreen({ filter, setFilter, columns, go, t }) {
  const list = filter === "Todos" ? AREAS : AREAS.filter((a) => a.cat === filter);

  return (
    <main data-screen-label="Servicios">
      <section style={{ background: "var(--surface-sunken)", borderBottom: "1px solid var(--navy-100)", padding: "var(--space-10) var(--space-7)" }}>
        <div className="ms-container">
          {/* as="h1" — SectionHeading defaults to h2, which would leave this
              screen without a top-level heading. Purely semantic: the size
              still comes from --text-h2. */}
          <SectionHeading
            as="h1"
            eyebrow={t("Servicios")}
            title={t("Selección de servicios legales y notariales")}
            description={t("Asuntos criminales, civiles, de familia, laborales y notariales, ante los tribunales estatales y federales de Puerto Rico.")}
          />
        </div>
      </section>

      <section className="ms-container" style={{ padding: "var(--space-9) var(--space-7) var(--space-11)" }}>
        <div role="group" aria-label={t("Filtrar")} style={{ display: "flex", alignItems: "center", gap: "var(--space-3)", flexWrap: "wrap", paddingBottom: "var(--space-7)", borderBottom: "1px solid var(--border-subtle)" }}>
          <span style={{ font: "var(--fw-semibold) 11.5px/1 var(--font-body)", letterSpacing: "0.14em", textTransform: "uppercase", color: "var(--ink-500)", marginRight: "var(--space-2)" }}>{t("Filtrar")}</span>
          {FILTERS.map((label) => {
            const selected = filter === label;
            const choose = () => setFilter(label);
            return (
              <Tag
                key={label}
                selected={selected}
                onClick={choose}
                onKeyDown={(e) => { if (e.key === "Enter" || e.key === " ") { e.preventDefault(); choose(); } }}
                role="button"
                tabIndex={0}
                aria-pressed={selected}
                style={{ cursor: "pointer", userSelect: "none" }}
              >{t(label)}</Tag>
            );
          })}
        </div>

        <div className="ms-services-grid" style={{ "--ms-cols": columns, marginTop: "var(--space-8)" }}>
          {list.map((a) => (
            <PracticeAreaCard
              key={a.title}
              icon={a.icon}
              title={t(a.title)}
              description={t(a.description)}
              linkLabel={t("Contáctenos")}
              onClick={go("Contacto")}
            />
          ))}
        </div>

        <div className="ms-note-grid" style={{ marginTop: "var(--space-9)" }}>
          <div style={{ padding: "36px", background: "var(--surface-card)", border: "1px solid var(--border-subtle)", borderTop: "var(--rule-width) solid var(--accent)", borderRadius: "var(--radius-md)" }}>
            <span style={{ font: "var(--fw-semibold) 11.5px/1 var(--font-body)", letterSpacing: "0.14em", textTransform: "uppercase", color: "var(--accent)" }}>{t("Construcción y permisos")}</span>
            <h3 style={{ margin: "14px 0 var(--space-3)", font: "var(--fw-semibold) 26px/1.2 var(--font-display)", color: "var(--text-heading)" }}>
              {t("Contratos de construcción, permisos y reclamaciones de obra")}
            </h3>
            <p style={{ margin: 0, maxWidth: "62ch", font: "var(--fw-regular) var(--fs-body)/1.7 var(--font-body)", color: "var(--text-body)" }}>
              {t("Antes de estudiar derecho, el Lcdo. Morales Schmidt obtuvo un bachillerato en ingeniería aeroespacial de la Universidad Texas A&M. Esa formación técnica se aplica a la redacción y ejecución de contratos de obra, trámites de permisos y controversias entre dueños, contratistas y subcontratistas.")}
            </p>
          </div>
          <div style={{ padding: "var(--space-7)", background: "var(--surface-deep)", borderRadius: "var(--radius-md)", color: "var(--white)", display: "flex", flexDirection: "column", gap: "var(--space-4)" }}>
            <span style={{ font: "var(--fw-semibold) 11.5px/1 var(--font-body)", letterSpacing: "0.14em", textTransform: "uppercase", color: "var(--gold-400)" }}>{t("Asesoría personalizada")}</span>
            <p style={{ margin: 0, font: "var(--fw-regular) 15px/1.65 var(--font-body)", color: "var(--navy-100)" }}>
              {t("Explíquenos su situación y le indicamos el próximo paso y el costo antes de comenzar.")}
            </p>
            <Button variant="gold" fullWidth onClick={go("Contacto")}>{t("Contáctenos")}</Button>
            <span style={{ font: "var(--fw-regular) 12.5px/1.5 var(--font-body)", color: "var(--navy-300)" }}>
              {t("+1-787-993-2109 · lunes a viernes, 9:00 am a 6:00 pm")}
            </span>
          </div>
        </div>

        <p style={{ margin: "var(--space-8) 0 0", font: "var(--fw-regular) 13px/1.6 var(--font-body)", color: "var(--text-muted)" }}>
          {t("La información de esta página es general y no constituye asesoría legal.")}
        </p>
      </section>
    </main>
  );
}

/* ── El bufete ────────────────────────────────────────────────────────────*/

function FirmScreen({ t }) {
  const credentials = ["Tribunales estatales y federales", "Notaría", "Servicios en toda la Isla"];
  const principles = [
    ["Un solo punto de contacto", "Usted sabe con quién habla y a quién llamar durante todo el trámite."],
    ["Estimado por escrito", "Antes de comenzar recibirá el alcance del trabajo y el costo, por escrito."],
    ["Lenguaje llano", "Le explicamos el procedimiento en palabras corrientes y guardamos el vocabulario técnico para los documentos."],
  ];

  return (
    <main data-screen-label="El bufete">
      <section style={{ background: "var(--surface-sunken)", borderBottom: "1px solid var(--navy-100)", padding: "var(--space-10) var(--space-7)" }}>
        <div className="ms-container">
          <SectionHeading
            as="h1"
            eyebrow={t("El bufete")}
            title={t("Una alternativa profesional")}
            description={t("Bufete de abogados y notaría en Bayamón, en funciones desde 2012.")}
          />
        </div>
      </section>

      <section className="ms-container ms-bio-grid" style={{ padding: "80px var(--space-7)" }}>
        <div>
          <PhotoSlot caption={t("Retrato · pendiente")} monogramWidth={120} style={{ aspectRatio: "4 / 5" }} />
          <ul style={{ listStyle: "none", padding: 0, margin: "var(--space-6) 0 0", display: "flex", flexDirection: "column", gap: "var(--space-3)" }}>
            {credentials.map((c) => (
              <li key={c} style={{ display: "flex", gap: "var(--space-3)", alignItems: "flex-start", font: "var(--fw-regular) 14.5px/1.6 var(--font-body)", color: "var(--text-body)" }}>
                <Icon name="check" size="sm" color="var(--navy-600)" style={{ marginTop: 2 }} />{t(c)}
              </li>
            ))}
          </ul>
        </div>

        <div style={{ display: "flex", flexDirection: "column", gap: 22, alignItems: "flex-start" }}>
          <span style={{ font: "var(--fw-semibold) 11.5px/1 var(--font-body)", letterSpacing: "0.14em", textTransform: "uppercase", color: "var(--accent)" }}>{t("Titular del bufete")}</span>
          <h2 style={{ margin: 0, font: "var(--fw-semibold) 44px/1.12 var(--font-display)", color: "var(--text-heading)" }}>Manuel L. Morales Schmidt</h2>
          <p style={{ margin: 0, maxWidth: "64ch", font: "var(--fw-regular) 17px/1.7 var(--font-body)", color: "var(--text-body)" }}>
            {t("El Lcdo. Morales Schmidt es el titular de este Bufete de abogados y Notaría en Bayamón. Desde 2012 su grupo de abogados brinda asesoría legal, estatal y federal en toda la Isla.")}
          </p>
          <p style={{ margin: 0, maxWidth: "64ch", font: "var(--fw-regular) 17px/1.7 var(--font-body)", color: "var(--text-body)" }}>
            {t("Es juris doctor de la Pontificia Universidad Católica de Puerto Rico, Summa Cum Laude, y fue el estudiante de más alto promedio de su clase graduanda. Antes de estudiar derecho obtuvo un bachillerato en ingeniería aeroespacial de la Universidad Texas A&M, formación que aplica hoy a los asuntos de construcción y permisos.")}
          </p>
          <Quote
            quote={t("No prometemos resultados. Prometemos que usted va a entender su caso en cada etapa.")}
            author="Lcdo. Morales Schmidt"
            meta={t("Titular del bufete")}
            style={{ marginTop: "10px" }}
          />
        </div>
      </section>

      <section style={{ background: "var(--surface-deep)", padding: "64px var(--space-7)" }}>
        <div className="ms-container ms-stats-4">
          <Stat value="2012" label={t("En funciones desde")} tone="dark" />
          <Stat value="7" label={t("Áreas de práctica")} tone="dark" />
          <Stat value={t("Estatal y federal")} label={t("Foros")} tone="dark" />
          <Stat value="Bayamón" label={t("Oficina · toda la Isla")} tone="dark" />
        </div>
      </section>

      <section className="ms-container" style={{ padding: "88px var(--space-7)" }}>
        <SectionHeading eyebrow={t("Cómo trabajamos")} title={t("Lo que puede esperar del bufete")} />
        <div className="ms-cards-3" style={{ marginTop: "44px" }}>
          {principles.map(([title, body]) => (
            <Card key={title} topRule>
              <h3 style={{ margin: "0 0 10px", font: "var(--fw-semibold) 22px/1.25 var(--font-display)", color: "var(--text-heading)" }}>{t(title)}</h3>
              <p style={{ margin: 0, font: "var(--fw-regular) 15px/1.7 var(--font-body)", color: "var(--text-muted)" }}>{t(body)}</p>
            </Card>
          ))}
        </div>
      </section>
    </main>
  );
}

/* ── Contacto ─────────────────────────────────────────────────────────────*/

const EMAIL_RE = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;

function ContactScreen({ t, lang }) {
  const [form, setForm] = useState({ name: "", email: "", phone: "", subject: "Consulta general", message: "" });
  const [errors, setErrors] = useState({});
  const [sent, setSent] = useState(false);
  const [sending, setSending] = useState(false);
  const [sendError, setSendError] = useState("");
  /* Honeypot + fill-time are the two spam screens. Both are checked again on
     the server; these are only what the browser contributes. */
  const [trap, setTrap] = useState("");
  const openedAt = React.useRef(Date.now());

  /* Clearing the field's error as it is corrected keeps the red state from
     lingering after the problem is fixed. */
  const on = (k) => (e) => {
    const { value } = e.target;
    setForm((f) => ({ ...f, [k]: value }));
    setErrors((prev) => (prev[k] ? { ...prev, [k]: "" } : prev));
  };

  /* The canvas validated the email only, but marks name and message required
     too. Enforcing all three keeps the asterisks honest. Error strings are in
     the firm's register — usted, plain, no exclamation. The server re-checks
     all of this; nothing here is a security control. */
  const submit = async (e) => {
    e.preventDefault();
    if (sending) return;

    const next = {};
    if (!form.name.trim()) next.name = "Escriba su nombre.";
    if (!EMAIL_RE.test(form.email)) next.email = "Formato de correo inválido.";
    if (!form.message.trim()) next.message = "Escriba su mensaje.";
    setErrors(next);
    if (Object.keys(next).length) {
      const first = document.getElementById("ms-" + ["name", "email", "message"].find((k) => next[k]));
      if (first) first.focus();
      return;
    }

    setSending(true);
    setSendError("");
    try {
      const res = await fetch("/api/contact", {
        method: "POST",
        headers: { "content-type": "application/json" },
        body: JSON.stringify({
          ...form,
          lang,
          empresa: trap,
          elapsedMs: Date.now() - openedAt.current,
        }),
      });
      const data = await res.json().catch(() => ({}));

      if (res.status === 422 && Array.isArray(data.fields)) {
        /* The server disagreed with the browser. Surface it on the fields
           rather than as a generic failure. */
        const msg = { name: "Escriba su nombre.", email: "Formato de correo inválido.", message: "Escriba su mensaje." };
        setErrors(Object.fromEntries(data.fields.map((f) => [f, msg[f]])));
        return;
      }
      if (!res.ok || !data.ok) throw new Error(data.error || `http_${res.status}`);
      setSent(true);
    } catch (err) {
      /* Never show the success state on a failed send: the enquirer would
         believe they had contacted a lawyer when nobody had. */
      console.error("contact submit failed:", err);
      setSendError("No pudimos enviar su consulta.");
    } finally {
      setSending(false);
    }
  };

  return (
    <main data-screen-label="Contacto">
      <section style={{ background: "var(--surface-sunken)", borderBottom: "1px solid var(--navy-100)", padding: "var(--space-10) var(--space-7)" }}>
        <div className="ms-container">
          <SectionHeading
            as="h1"
            eyebrow={t("Contacto")}
            title={t("Leemos sus dudas y comentarios")}
            description={t("Escriba su consulta y le responderemos desde la oficina de Bayamón.")}
          />
        </div>
      </section>

      <section className="ms-container ms-contact-grid" style={{ padding: "var(--space-10) var(--space-7) var(--space-11)" }}>
        <div>
          {sent ? (
            <Alert tone="success" title={t("Recibimos su consulta")}>
              {t("Le responderemos durante el horario de oficina, de lunes a viernes.")}
            </Alert>
          ) : (
            <form className="ms-form-grid" onSubmit={submit} noValidate>
              <Field label={t("Nombre")} required error={errors.name ? t(errors.name) : ""} htmlFor="ms-name">
                <Input
                  id="ms-name" name="name" required
                  placeholder={t("Nombre y apellidos")}
                  value={form.name}
                  invalid={!!errors.name}
                  aria-invalid={!!errors.name}
                  onChange={on("name")}
                  autoComplete="name"
                />
              </Field>
              <Field label={t("Correo electrónico")} required error={errors.email ? t(errors.email) : ""} htmlFor="ms-email">
                <Input
                  id="ms-email" name="email" type="email" required
                  placeholder={t("nombre@correo.com")}
                  value={form.email}
                  invalid={!!errors.email}
                  aria-invalid={!!errors.email}
                  onChange={on("email")}
                  autoComplete="email"
                />
              </Field>
              <Field label={t("Teléfono")} htmlFor="ms-phone">
                <Input id="ms-phone" name="phone" type="tel" placeholder="787-000-0000" value={form.phone} onChange={on("phone")} autoComplete="tel" />
              </Field>
              <Field label={t("Asunto")} htmlFor="ms-subject">
                <Select id="ms-subject" name="subject" options={SUBJECTS.map((s) => ({ value: s, label: t(s) }))} value={form.subject} onChange={on("subject")} />
              </Field>
              <div className="ms-span-all">
                {/* Above the box, not below it: a conflicts warning is only
                    useful if it is read before the facts are typed. */}
                <p style={{ margin: "0 0 var(--space-3)", maxWidth: "62ch", font: "var(--fw-regular) 13px/1.6 var(--font-body)", color: "var(--text-muted)" }}>
                  {t("Describa brevemente su situación. No incluya información confidencial en este formulario.")}
                </p>
                <Field
                  label={t("Mensaje")}
                  required
                  error={errors.message ? t(errors.message) : ""}
                  htmlFor="ms-message"
                >
                  <Textarea
                    id="ms-message" name="message" required rows={6}
                    placeholder={t("Escriba aquí su consulta")}
                    value={form.message}
                    invalid={!!errors.message}
                    aria-invalid={!!errors.message}
                    onChange={on("message")}
                  />
                </Field>
              </div>

              {/* Honeypot. Off-screen rather than display:none, unfocusable and
                  hidden from assistive tech; bots fill it, people cannot. */}
              <div aria-hidden="true" style={{ position: "absolute", left: "-9999px", width: 1, height: 1, overflow: "hidden" }}>
                <label htmlFor="ms-empresa">Empresa</label>
                <input
                  id="ms-empresa" name="empresa" type="text" tabIndex={-1}
                  autoComplete="off" value={trap} onChange={(e) => setTrap(e.target.value)}
                />
              </div>

              {sendError ? (
                <div className="ms-span-all">
                  <Alert tone="danger" title={t(sendError)}>
                    {t("Inténtelo de nuevo en un momento o llámenos al +1-787-993-2109.")}
                  </Alert>
                </div>
              ) : null}

              <div className="ms-span-all" style={{ display: "flex", alignItems: "center", justifyContent: "space-between", gap: "var(--space-6)", flexWrap: "wrap", paddingTop: "var(--space-2)", borderTop: "1px solid var(--border-subtle)" }}>
                <p style={{ margin: "var(--space-4) 0 0", maxWidth: "46ch", font: "var(--fw-regular) 13px/1.6 var(--font-body)", color: "var(--text-muted)" }}>
                  {t("Enviar este formulario no crea una relación abogado-cliente.")}
                </p>
                <Button
                  type="submit" size="lg"
                  iconRight={sending ? undefined : "arrow-right"}
                  disabled={sending}
                  aria-busy={sending}
                  style={{ marginTop: "var(--space-4)" }}
                >{sending ? t("Enviando…") : t("Enviar")}</Button>
              </div>
            </form>
          )}
        </div>

        <div style={{ display: "flex", flexDirection: "column", gap: "var(--space-6)" }}>
          <div style={{ padding: "var(--space-7)", background: "var(--surface-deep)", borderRadius: "var(--radius-md)", color: "var(--white)", display: "flex", flexDirection: "column", gap: 18 }}>
            <span style={{ font: "var(--fw-semibold) 11.5px/1 var(--font-body)", letterSpacing: "0.14em", textTransform: "uppercase", color: "var(--gold-400)" }}>{t("La oficina")}</span>
            <IconLine icon="map-pin">{t(OFFICE.address)}</IconLine>
            <IconLine icon="clock">{t(OFFICE.hours)}</IconLine>
            <IconLine icon="phone">{t("+1-787-993-2109 · WhatsApp")}</IconLine>
            <IconLine icon="file-text">Fax {OFFICE.fax}</IconLine>
            <IconLine icon="mail" style={{ wordBreak: "break-all" }}>{OFFICE.email}</IconLine>
            <div style={{ display: "flex", flexDirection: "column", gap: "var(--space-3)", marginTop: 6, paddingTop: 18, borderTop: "1px solid var(--navy-800)" }}>
              <Button variant="gold" fullWidth iconLeft="phone" onClick={() => { location.href = "tel:" + OFFICE.tel; }}>{t("Llamar al bufete")}</Button>
              <Button variant="inverse" fullWidth onClick={() => { location.href = "https://wa.me/" + OFFICE.tel.replace("+", ""); }}>{t("Escribir por WhatsApp")}</Button>
            </div>
          </div>
          <div style={{ position: "relative", height: 220, background: "var(--surface-sunken)", border: "1px solid var(--border-subtle)", display: "flex", alignItems: "center", justifyContent: "center" }}>
            <span style={{ font: "var(--fw-medium) 11px/1 var(--font-body)", letterSpacing: "0.14em", textTransform: "uppercase", color: "var(--ink-500)" }}>{t("Mapa · Bayamón")}</span>
          </div>
        </div>
      </section>
    </main>
  );
}

/* ── App ──────────────────────────────────────────────────────────────────*/

function App() {
  const [page, setPage] = useState("Inicio");
  const [lang, setLang] = useState(CONFIG.initialLang);
  const [filter, setFilter] = useState("Todos");

  const t = useCallback((s) => (lang === "en" && EN[s] ? EN[s] : s), [lang]);

  const go = useCallback((target) => (e) => {
    if (e && e.preventDefault) e.preventDefault();
    setPage(target);
    window.scrollTo(0, 0);
  }, []);

  /* Keep the document in step with the chosen language, for screen readers,
     browser translation prompts and native form validation messages. */
  useEffect(() => {
    document.documentElement.lang = lang;
    document.title = lang === "en"
      ? "Morales Schmidt LLC — Law Office and Notary"
      : "Morales Schmidt LLC — Bufete de Abogados y Notaría";
  }, [lang]);

  return (
    <div style={{ fontFamily: "var(--font-body)", color: "var(--text-body)", background: "var(--surface-page)", minHeight: "100vh" }}>
      <SiteHeader page={page} go={go} lang={lang} setLang={setLang} t={t} />

      {page === "Inicio"    && <HomeScreen go={go} t={t} />}
      {page === "Servicios" && <ServicesScreen filter={filter} setFilter={setFilter} columns={CONFIG.servicesColumns} go={go} t={t} />}
      {page === "El bufete" && <FirmScreen t={t} />}
      {page === "Contacto"  && <ContactScreen t={t} lang={lang} />}

      <SiteFooter go={go} t={t} />
    </div>
  );
}

ReactDOM.createRoot(document.getElementById("root")).render(<App />);
