/* ===========================================================
   CrocoWeb - estilos
   Paleta, tipografía y layout doodle/hand-drawn
   =========================================================== */

:root {
  --verde: #3B8C4E;
  --verde-oscuro: #1F4A3F;
  --verde-agua: #4AA69A;
  --naranja: #E8792B;
  --papel: #F5F1E6;
  --crema: #EDE4C8;

  /* Caveat es la firma del sitio: titulos, botones, logo, numeros de paso,
     categorias y las palabras marcadas. Nunito es SOLO para cuerpo de texto
     (parrafos, bullets, labels del form), donde una manuscrita a 17px cuesta
     leerse. Si agregas un selector nuevo, pensa a cual de las dos pertenece. */
  --font-title: 'Caveat', cursive;
  --font-body: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --shadow-offset: 6px;
  --radius: 14px;

  --container-w: 1140px;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: auto; }
body, h1, h2, h3, p, ol, ul, figure { margin: 0; }
ol, ul { padding: 0; list-style: none; }
/* height:auto es obligatorio junto con los atributos width/height del HTML:
   si no, el `height` del atributo se aplica como valor por defecto y deforma
   cualquier imagen a la que el CSS le fije sólo el ancho (p. ej. .mascot-img).
   Las reglas que sí quieren una altura concreta (.logo-img, .phone-screen img,
   .browser-content.shot img) la declaran por clase y ganan por especificidad. */
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; }

body {
  /* El 1.2em de antes compensaba lo chica que se ve Caveat. Nunito tiene una
     altura de x mucho mayor: al mismo tamano se veria desproporcionada, por
     eso baja a 1.05em. Los titulos no se ven afectados, usan clamp() con
     rem/vw y no dependen del font-size del body. */
  font-family: var(--font-body);
  font-size: 1.05em;
  color: var(--verde-oscuro);
  background-color: var(--papel);
  background-image:
    repeating-linear-gradient(
      to bottom,
      rgba(31, 74, 63, 0.035) 0px,
      rgba(31, 74, 63, 0.035) 1px,
      transparent 1px,
      transparent 34px
    ),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/></svg>");
  line-height: 1.5;
  overflow-x: hidden;
}

.container {
  width: 100%;
  max-width: var(--container-w);
  margin-inline: auto;
  padding-inline: 20px;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: auto;
  background: var(--verde-oscuro);
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  z-index: 1000;
}
.skip-link:focus {
  left: 20px;
  top: 20px;
}

:focus-visible {
  outline: 3px solid var(--naranja);
  outline-offset: 3px;
}

h1, h2, h3 {
  font-family: var(--font-title);
  font-weight: 700;
  line-height: 1.1;
  color: var(--verde-oscuro);
}

h1 { font-size: clamp(2.6rem, 6vw + 1rem, 5rem); }
.section-title { font-size: clamp(2.2rem, 4vw + 1rem, 3.4rem); margin-bottom: 12px; }
h3 { font-size: clamp(1.4rem, 2vw + 1rem, 1.8rem); margin-bottom: 6px; }

.section-sub {
  font-size: 1.05rem;
  max-width: 46ch;
  opacity: 0.85;
  margin-bottom: 40px;
}

/* ---------- Rough-notation targets ---------- */
.rn-mark { display: inline-block; position: relative; }
.rn-target { position: relative; }

/* ---------- Buttons (Rough.js frame drawn around .btn) ---------- */
.btn {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 28px;
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--verde-oscuro);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: transform 0.15s ease;
}
.btn:hover { transform: translate(-2px, -2px); }
.btn:active { transform: translate(0, 0); }
.btn:disabled { opacity: 0.7; cursor: default; pointer-events: none; }

.btn-primary { color: var(--verde-oscuro); }
.btn-primary .rough-fill { fill: var(--naranja); }
.btn-outline .rough-fill { fill: var(--papel); }

.btn-small {
  padding: 9px 18px;
  font-size: 0.9rem;
}

.rough-frame-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  z-index: -1;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--papel);
  border-bottom: 2px solid var(--verde-oscuro);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 10px;
  gap: 16px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo-img {
  width: 44px;
  height: 44px;
  object-fit: contain;
}
.logo-text {
  font-family: var(--font-title);
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--verde-oscuro);
}
.logo-text .accent { color: var(--verde-agua); }

.main-nav {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
}
.main-nav a:not(.btn) {
  /* El nav se queda en Caveat: son etiquetas cortas (no hay problema de
     legibilidad) y viven al lado del logo, que tambien es Caveat. En Nunito
     el header quedaba partido en dos tipografias. */
  font-family: var(--font-title);
  font-size: 1.15rem;
  font-weight: 700;
  position: relative;
}

/* ---------- Menú móvil ----------
   Debajo de 900px el nav completo no entra al lado del logo: envolvía en
   3 filas y dejaba el header sticky en 163px (23% de la pantalla). */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 9px;
  background: none;
  border: none;
  cursor: pointer;
  z-index: 130;
}
.nav-toggle span {
  display: block;
  width: 100%;
  height: 3px;
  border-radius: 2px;
  background: var(--verde-oscuro);
  transition: transform 0.25s var(--ease, ease), opacity 0.2s ease;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

@media (max-width: 899px) {
  .nav-toggle { display: flex; }
  /* Se desliza con transform y no con `right`: es la propiedad que el
     compositor puede animar sin recalcular layout en cada frame. */
  .main-nav {
    position: fixed;
    top: 0;
    right: 0;
    width: min(80%, 320px);
    height: 100vh;
    height: 100dvh;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 30px;
    padding: 32px;
    background: var(--papel);
    border-left: 2px solid var(--verde-oscuro);
    box-shadow: -8px 0 0 rgba(31, 74, 63, 0.08);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 120;
  }
  .main-nav.is-open { transform: translateX(0); }
  .main-nav a { font-size: 1.35rem; }
  /* Capa transparente: sólo captura el toque para cerrar el menú, sin oscurecer. */
  .nav-backdrop {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 110;
  }
  .nav-backdrop.is-open { pointer-events: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .main-nav, .nav-toggle span { transition: none !important; }
}

/* ---------- Hero ---------- */
.hero {
  padding-block: 60px 80px;
  overflow: hidden;
}
.hero-inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
  align-items: center;
}
.hero-copy h1 { margin-bottom: 20px; }
.hero-sub {
  font-size: 1.15rem;
  max-width: 48ch;
  margin-bottom: 28px;
  opacity: 0.9;
}
.hero-mascot { display: flex; justify-content: center; }
.mascot-wrap {
  position: relative;
  display: inline-block;
  will-change: transform;
}
.mascot-img {
  width: min(420px, 82vw);
  filter: drop-shadow(8px 10px 0 rgba(31, 74, 63, 0.12));
  display: block;
}

/* Ojos del croco del hero, siguen el cursor */
.croco-eyes {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.eye-cover,
.eye-pupil {
  position: absolute;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}
.eye-cover {
  /* proporciones calculadas sobre mascota.png (686x1024) para que el círculo no se ovale */
  width: 4.37%;
  height: 2.93%;
  background: #023a2d;
}
.eye-pupil {
  width: 1.53%;
  height: 1.03%;
  background: #fff;
  box-shadow: 0 0 1px 0.4px rgba(255, 255, 255, 0.55);
}

@media (prefers-reduced-motion: reduce), (pointer: coarse) {
  .croco-eyes { display: none; }
}

/* ---------- Cards / Servicios ---------- */
.servicios { padding-block: 70px; }
.cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 34px;
  margin-top: 14px;
}
.card {
  position: relative;
  isolation: isolate;
  display: block;
  padding: 30px 26px;
  background: transparent;
  cursor: pointer;
  transition: transform 0.22s ease;
}
/* El :hover se limita a punteros reales. En táctil el navegador lo aplica al
   arrastrar el dedo, y la tarjeta se agrandaba a mitad del scroll: eso era lo
   que se sentía como tirones. El foco de teclado conserva el efecto. */
@media (hover: hover) {
  .card:hover {
    transform: scale(1.1) !important;
    transition: transform 0.22s ease !important;
  }
}
.card:focus-visible {
  transform: scale(1.1) !important;
  transition: transform 0.22s ease !important;
}
.rough-hover-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.2s ease;
}
@media (hover: hover) {
  .card:hover .rough-hover-svg { opacity: 1; }
}
.card:focus-visible .rough-hover-svg { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .card { transition: none; }
  .card:hover, .card:focus-visible { transform: none; }
}
.card-icon {
  width: 56px;
  height: 56px;
  margin-bottom: 14px;
}
.card p { opacity: 0.85; }

/* ---------- Detalle de servicio ---------- */
.servicio-detail { padding-block: 70px; background: var(--crema); }
.servicio-detail-page { padding-block: 90px; min-height: calc(100vh - 220px); }
.back-link {
  display: inline-block;
  margin-bottom: 18px;
  font-weight: 700;
  color: var(--verde-oscuro);
}
.back-link:hover { color: var(--naranja); }
.feature-list {
  display: grid;
  gap: 12px;
  max-width: 60ch;
  margin: 24px 0 34px;
}
.feature-list li {
  position: relative;
  padding-left: 30px;
  font-size: 1.2rem;
}
.feature-list li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--naranja);
  font-weight: 800;
}
.servicio-detail-inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
  align-items: center;
}
.servicio-detail-sketch { display: flex; justify-content: center; }
.sketch-wrap {
  width: min(468px, 90vw);
}
.sketch-wrap .sketch-svg {
  width: 100%;
  height: auto;
  filter: drop-shadow(6px 8px 0 rgba(31, 74, 63, 0.1));
}

@media (min-width: 900px) {
  .servicio-detail-inner { grid-template-columns: 1.15fr 0.85fr; }
}

.servicio-detail-sketch .phone-frame {
  width: min(300px, 85vw);
  cursor: default;
}
.servicio-detail-sketch .phone-frame:hover,
.servicio-detail-sketch .phone-frame:focus-visible {
  transform: none !important;
}
.servicio-detail-sketch .browser-frame {
  width: min(480px, 90vw);
  cursor: default;
}
.servicio-detail-sketch .browser-frame:hover,
.servicio-detail-sketch .browser-frame:focus-visible {
  transform: none !important;
}
.servicio-detail-sketch .browser-content.shot { height: 300px; }
/* ---------- Proceso ---------- */
.proceso { padding-block: 70px; background: var(--crema); }
.steps {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
  position: relative;
  z-index: 1;
}
.step { text-align: center; }
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  font-family: var(--font-title);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--verde-oscuro);
  margin-bottom: 14px;
  position: relative;
  isolation: isolate;
}
.step p { opacity: 0.8; font-size: 0.95rem; max-width: 26ch; margin-inline: auto; }

.steps-wrap { position: relative; }
.steps-arrows {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: none;
}

/* ---------- Portfolio ---------- */
.portfolio { padding-block: 70px; }
.portfolio-cat {
  font-family: var(--font-title);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--verde-oscuro);
  margin: 40px 0 18px;
}
.portfolio-cat:first-of-type { margin-top: 0; }
.portfolio-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 34px;
}
.browser-frame {
  position: relative;
  isolation: isolate;
  display: block;
  background: #fff;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.22s ease;
}
@media (hover: hover) {
  .browser-frame:hover {
    transform: scale(1.05) !important;
    transition: transform 0.22s ease !important;
  }
}
.browser-frame:focus-visible {
  transform: scale(1.05) !important;
  transition: transform 0.22s ease !important;
}
@media (prefers-reduced-motion: reduce) {
  .browser-frame { transition: none; }
  .browser-frame:hover, .browser-frame:focus-visible { transform: none !important; }
}
.browser-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-bottom: 2px solid var(--verde-oscuro);
  position: relative;
  z-index: 1;
}
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot-1 { background: var(--naranja); }
.dot-2 { background: var(--verde-agua); }
.dot-3 { background: var(--verde); }
.browser-content.placeholder {
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-title);
  font-size: 1.4rem;
  color: var(--verde-oscuro);
  opacity: 0.5;
  position: relative;
  z-index: 1;
}
.browser-content.shot {
  display: block;
  position: relative;
  z-index: 1;
  height: 190px;
  padding: 12px;
  overflow: hidden;
  box-sizing: border-box;
}
.browser-content.shot img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: top center;
  background: #fff;
  transition: transform 0.3s ease;
}
.browser-info {
  position: relative;
  z-index: 1;
  padding: 18px 20px 22px;
}
.browser-info h3 { font-size: 1.5rem; margin-bottom: 4px; }
.browser-info p { opacity: 0.85; font-size: 0.98rem; }

/* ---------- Apps móviles ---------- */
.apps-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  margin-top: 40px;
  justify-items: center;
}
.phone-frame {
  position: relative;
  isolation: isolate;
  display: block;
  box-sizing: border-box;
  width: min(168px, 100%);
  padding: 9px;
  background: #fff;
  overflow: hidden;
  border-radius: 16px;
  cursor: pointer;
  transition: transform 0.22s ease;
}
.phone-frame:hover,
.phone-frame:focus-visible {
  transform: scale(1.05) !important;
  transition: transform 0.22s ease !important;
}
@media (prefers-reduced-motion: reduce) {
  .phone-frame { transition: none; }
  .phone-frame:hover, .phone-frame:focus-visible { transform: none !important; }
}
.phone-bar {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  padding: 2px 0 7px;
}
.phone-notch {
  width: 32px;
  height: 6px;
  border-radius: 4px;
  background: var(--verde-oscuro);
  opacity: 0.8;
}
.phone-title {
  position: relative;
  z-index: 1;
  text-align: center;
  font-size: 1.05rem;
  padding: 0 10px;
  margin: 0 0 8px;
}
.phone-screen {
  position: relative;
  z-index: 1;
  aspect-ratio: 9 / 19.5;
  overflow: hidden;
  border-radius: 8px;
  background: var(--verde-oscuro);
}
.phone-screen.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-title);
  font-size: 1rem;
  color: #fff;
  opacity: 0.6;
}
.phone-screen img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

@media (min-width: 640px) {
  .apps-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- Contacto ---------- */
.contacto { padding-block: 100px; }
.contacto-inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
  align-items: center;
}
.contacto-heading-wrap { position: relative; }
.contacto-heading {
  font-size: clamp(2.4rem, 4.4vw + 1rem, 3.6rem);
  line-height: 1.3;
  margin-bottom: 0;
}
.heading-line { display: block; }
.heading-line + .heading-line { margin-top: 6px; }

.mark-wrap { position: relative; display: inline-block; }
.mark-word { position: relative; z-index: 1; }
.mark-wrap svg.word-mark-svg { position: absolute; inset: 0; overflow: visible; pointer-events: none; }

.mark-wrap[data-mark="line"] { padding: 2px 6px 14px; }
.mark-wrap[data-mark="circle"] { padding: 4px 10px 8px; margin: 0 2px; }
.mark-wrap[data-mark="interface"] { padding: 20px 18px 6px 10px; margin: 0 2px; }

.contacto-heading-arrows {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.contacto-heading-arrows svg { overflow: visible; }
.email-form {
  display: grid;
  gap: 16px;
  max-width: 420px;
  margin-top: 34px;
  position: relative;
}
/* honeypot: fuera de pantalla y fuera del flujo, para no ocupar celda del grid */
.email-form .hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.email-form .fg label {
  display: block;
  font-weight: 700;
  margin-bottom: 4px;
}
.email-form .fg input,
.email-form .fg textarea {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid var(--verde-oscuro);
  border-radius: 8px;
  background: #fffdf8;
  font-family: inherit;
  font-size: 1.1rem;
  color: var(--verde-oscuro);
}
.email-form .fg textarea { resize: vertical; }
.form-status {
  font-weight: 700;
  font-size: 1.1rem;
  min-height: 1.4em;
}
.form-status.is-success { color: var(--verde); }
.form-status.is-error { color: var(--naranja); }
.contacto-mascot { display: flex; justify-content: center; }
.mascot-wave {
  width: min(340px, 72vw);
  transform-origin: 70% 90%;
  animation: croco-wave 3.2s ease-in-out infinite;
}
@keyframes croco-wave {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(-3deg); }
}

/* ---------- Cursor personalizado ---------- */
.custom-cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 22px;
  height: 28px;
  pointer-events: none;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.custom-cursor.is-active { opacity: 1; }
.custom-cursor-inner {
  width: 100%;
  height: 100%;
  transform-origin: 15% 10%;
  transition: transform 0.18s ease;
}
.custom-cursor.is-hover .custom-cursor-inner {
  transform: scale(1.35);
}

body.custom-cursor-active,
body.custom-cursor-active * {
  cursor: none;
}

@media (pointer: coarse) {
  .custom-cursor { display: none !important; }
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 2px solid var(--verde-oscuro);
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-block: 24px;
}
.footer-logo { display: flex; align-items: center; gap: 8px; }
.footer-logo .logo-img { width: 34px; height: 34px; }
.footer-logo .logo-text { font-size: 1.3rem; }
.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}
/* Mismo criterio que .main-nav: navegacion en Caveat, junto al logo. */
.footer-nav a { font-family: var(--font-title); font-size: 1.15rem; font-weight: 700; }
.footer-nav a:hover { color: var(--naranja); }
.footer-copy {
  text-align: center;
  padding-block: 14px;
  border-top: 2px solid var(--verde-oscuro);
  font-size: 0.9rem;
  opacity: 0.8;
}

@media (max-width: 639px) {
  /* Los 4 enlaces en fila envolvían como 3 + 1, con "Contacto" solo abajo.
     En grilla de 2 columnas quedan 2 + 2, parejo y centrado bajo el logo. */
  .footer-inner {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 24px;
  }
  .footer-nav {
    display: grid;
    grid-template-columns: repeat(2, auto);
    justify-content: center;
    column-gap: 28px;
    row-gap: 14px;
  }
}

/* ---------- Responsive ---------- */
@media (min-width: 640px) {
  .cards-grid { grid-template-columns: 1fr 1fr; }
  .portfolio-grid { grid-template-columns: 1fr 1fr; }
  .steps { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 900px) {
  .hero-inner { grid-template-columns: 1.1fr 0.9fr; }
  .cards-grid { grid-template-columns: repeat(3, 1fr); }
  .portfolio-grid { grid-template-columns: repeat(3, 1fr); }
  .systems-grid { grid-template-columns: repeat(4, 1fr); }
  .contacto-inner { grid-template-columns: 1.2fr 0.8fr; }
  .steps-arrows { display: block; }
}

/* ---------- Motion ---------- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .mascot-img, .mascot-wave { transition: none !important; animation: none !important; }
  * { scroll-behavior: auto !important; }
  .custom-cursor { display: none !important; }
}
